Data | Indexing with list with missing labels is deprecated in Pandas

date
Apr 12, 2020
slug
index-missing-label-deprecated-pandas
status
Published
summary
For .reindex , from 0.21.0, .loc or [] are not allowed to index with a list with one or more missing labels in Pandas
tags
Academic
Data Analysis
Python
Pandas
type
Post
For .reindex , from 0.21.0, .loc or [] are not allowed to index with a list with one or more missing labels in Pandas
📜
Starting in 0.21.0, using .loc or [] with a list with one or more missing labels, is deprecated, in favor of .reindex.
i.e.

Before

Simple:
Get:

After

Now, we only get:

Similar behavior in a simple way

In current version (>0.21.0), we can use .reindex to get expected result as before, according to the official document:
In DataFrame, similar:
More examples are listed here
Pandas updates a lot~~~ : (

© Rongxin 2021 - 2024