-
-
Notifications
You must be signed in to change notification settings - Fork 140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: #1008 columns in DataFrame.drop #1131
fix: #1008 columns in DataFrame.drop #1131
Conversation
check(assert_type(df.drop([0]), pd.DataFrame), pd.DataFrame) | ||
check(assert_type(df.drop(index=[0]), pd.DataFrame), pd.DataFrame) | ||
check(assert_type(df.drop(columns=["col1"]), pd.DataFrame), pd.DataFrame) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed since it duplicates L346 above
@@ -344,9 +344,9 @@ def test_types_drop() -> None: | |||
df = pd.DataFrame(data={"col1": [1, 2], "col2": [3, 4]}) | |||
check(assert_type(df.drop("col1", axis=1), pd.DataFrame), pd.DataFrame) | |||
check(assert_type(df.drop(columns=["col1"]), pd.DataFrame), pd.DataFrame) | |||
check(assert_type(df.drop(columns=iter(["col1"])), pd.DataFrame), pd.DataFrame) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
iter
might be the easiest way to make an iterable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add tests for drop(index=some_index)
where some_index
is an Index
and also add a set for drop(columns=some_set)
where some_set
is a set (to correspond to the issue that's being fixed)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks @cmp0xff
assert_type()
to assert the type of any return valueDataFrame.drop()
accept aset
for thecolumns
,index
andlabels
argument? pandas#59890, DOC: Update DataFrame.drop() docstring pandas#61013