It looks like Pandas has deprecated this method of indexing. According to their docs:
This behavior is deprecated and will show a warning message pointing
to this section. The recommended alternative is to use .reindex()
Using the new recommended method, you can filter your columns using:
tips_filtered = tips_df.reindex(columns = filtered_columns)
.
NB: To reindex rows, you would use reindex(index = ...)
(More information here).
Related Contents:
- Convert pandas dataframe to NumPy array
- Pandas read_csv: low_memory and dtype options
- Pandas conditional creation of a series/dataframe column
- What does axis in pandas mean?
- Split (explode) pandas dataframe string entry to separate rows
- How to take column-slices of dataframe in pandas
- How can I map True/False to 1/0 in a Pandas DataFrame?
- Binning a column with pandas
- What is dtype(‘O’), in pandas?
- How can I split a column of tuples in a Pandas dataframe?
- String concatenation of two pandas columns
- ‘DataFrame’ object has no attribute ‘sort’
- Ambiguity in Pandas Dataframe / Numpy Array “axis” definition
- Coalesce values from 2 columns into a single column in a pandas dataframe
- How to check if a value is in the list in selection from pandas data frame?
- Elegant way to create empty pandas DataFrame with NaN of type float
- Create new column based on values from other columns / apply a function of multiple columns, row-wise in Pandas
- Pandas Split Dataframe into two Dataframes at a specific row
- SQL-like window functions in PANDAS: Row Numbering in Python Pandas Dataframe
- python pandas flatten a dataframe to a list
- Performant cartesian product (CROSS JOIN) with pandas
- How do I tell if a column in a pandas dataframe is of type datetime? How do I tell if a column is numerical?
- Conditionally fill column values based on another columns value in pandas
- how to read certain columns from Excel using Pandas – Python
- Numpy “where” with multiple conditions
- Store numpy.array in cells of a Pandas.DataFrame
- Python pandas: how to remove nan and -inf values
- What’s the best way to sum all values in a Pandas dataframe? [duplicate]
- Pandas finding local max and min
- which is faster for load: pickle or hdf5 in python
- When to apply(pd.to_numeric) and when to astype(np.float64) in python?
- Pandas – Replace values based on index
- Calculate average of every x rows in a table and create new table
- pd.NA vs np.nan for pandas
- Unpivot Pandas Data
- How to add a new column to an existing DataFrame?
- Use a list of values to select rows from a Pandas dataframe
- Constructing pandas DataFrame from values in variables gives “ValueError: If using all scalar values, you must pass an index”
- How do I create test and train samples from one dataframe with pandas?
- Detect and exclude outliers in a pandas DataFrame
- How to find which columns contain any NaN value in Pandas dataframe
- Numpy isnan() fails on an array of floats (from pandas dataframe apply)
- How to concatenate multiple column values into a single column in Pandas dataframe
- pandas – change df.index from float64 to unicode or string
- Checking if particular value (in cell) is NaN in pandas DataFrame not working using ix or iloc
- How to flatten a pandas dataframe with some columns as json?
- Difference between groupby and pivot_table for pandas dataframes
- Stratified Sampling in Pandas
- pandas combine two columns with null values
- Python Numpy TypeError: ufunc ‘isfinite’ not supported for the input types