Closed
Description
Pandas version checks
- I have checked that the issue still exists on the latest versions of the docs on
main
here
Location of the documentation
https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.drop.html
Documentation problem
The arguments labels
, index
and columns
are documented as "single label or list-like". But a set is accepted:
import pandas as pd
df = pd.DataFrame({1: [2], 3: [4]}) # Fix is here
df = df.drop(columns={1})
The pandas source declaration in the typing declarations does not allow a set to be passed.
Suggested fix for documentation
Unclear.
Either we update the docs to say a set is allowed (and update the internal types), OR we add a check to see if a set is passed and raise an exception.
First raised as a pandas-stubs
issue in pandas-dev/pandas-stubs#1008