-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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
Strange behaviour of pd.DataFrame.drop() with inplace argument #30484
Comments
The use of the If you'd like to take a look internally would welcome a patch |
|
Regarding #30484 (comment) and #30484 (comment). I would also not recommend the use of the inplace keyword. Note however, that you may have to adjust your code because df = df.drop("target", axis=1) returns a copy and not a view. See #33438. |
Reopening since we are reverting the original fix because it caused another regression (see #36373) |
In the end we actually didn't revert the fix, but merged an alternative PR for the regression that preserved the fix for this issue: #37508. So closing again. |
Code Sample, a copy-pastable example if possible
Problem description
Pandas return DataFrame with removed column after doing in-place operation with a column. Is it a bug or intentional behavior?
Output of
pd.show_versions()
INSTALLED VERSIONS
commit : None
pandas : 0.25.1
numpy : 1.16.2
pytz : 2018.9
dateutil : 2.7.5
pip : 18.1
setuptools : 42.0.2
Cython : 0.29.2
pytest : 4.1.0
hypothesis : None
sphinx : 1.8.3
blosc : None
feather : None
xlsxwriter : 1.1.2
lxml.etree : 4.3.0
html5lib : 1.0.1
pymysql : None
psycopg2 : None
jinja2 : 2.10
IPython : 7.2.0
pandas_datareader: None
bs4 : 4.7.1
bottleneck : 1.2.1
fastparquet : None
gcsfs : None
lxml.etree : 4.3.0
matplotlib : 3.0.2
numexpr : 2.6.9
odfpy : None
openpyxl : 2.5.12
pandas_gbq : None
pyarrow : None
pytables : None
s3fs : None
scipy : 1.2.1
sqlalchemy : 1.2.15
tables : 3.4.4
xarray : 0.14.0
xlrd : 1.2.0
xlwt : 1.3.0
xlsxwriter : 1.1.2
The text was updated successfully, but these errors were encountered: