Passing list-likes to .loc or [] with any missing labels is no longer supported

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).

Leave a Comment