Skip to content

BUG: name argument in Series.reset_index behaves differently from doc when inplace==True #44575

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

Closed
2 of 3 tasks
isVoid opened this issue Nov 22, 2021 · 0 comments · Fixed by #44578
Closed
2 of 3 tasks
Labels
Bug Reshaping Concat, Merge/Join, Stack/Unstack, Explode
Milestone

Comments

@isVoid
Copy link
Contributor

isVoid commented Nov 22, 2021

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas.

  • I have confirmed this bug exists on the master branch of pandas.

Reproducible Example

>>> import pandas as pd
>>> s = pd.Series(range(4), name='oldser')
>>> s.reset_index(name='newser', drop=True)
0    0
1    1
2    2
3    3
Name: oldser, dtype: int64
>>> s.reset_index(name='newser', drop=True, inplace=True)
>>> s
0    0
1    1
2    2
3    3
Name: newser, dtype: int64

Issue Description

The documentation of Series.reset_index mentions that name argument is ignored when drop is True. This only applies when inplace is False.

Expected Behavior

When inplace is True, should either match behavior when inplace is False. Or should at least update documentation.

Installed Versions

INSTALLED VERSIONS

commit : 945c9ed
python : 3.8.12.final.0
python-bits : 64
OS : Linux
OS-release : 5.11.0-40-generic
Version : #44~20.04.2-Ubuntu SMP Tue Oct 26 18:07:44 UTC 2021
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : None
LOCALE : en_US.UTF-8

pandas : 1.3.4
numpy : 1.21.4
pytz : 2021.3
dateutil : 2.8.2
pip : 21.3.1
setuptools : 58.5.3
Cython : 0.29.24
pytest : 6.2.5
hypothesis : 6.24.3
sphinx : 4.3.0
blosc : None
feather : None
xlsxwriter : None
lxml.etree : 4.6.4
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 3.0.3
IPython : 7.29.0
pandas_datareader: None
bs4 : 4.10.0
bottleneck : None
fsspec : 2021.11.0
fastparquet : None
gcsfs : None
matplotlib : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : 5.0.0
pyxlsb : None
s3fs : None
scipy : None
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
numba : 0.53.1

@isVoid isVoid added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Nov 22, 2021
@jreback jreback added this to the 1.4 milestone Nov 25, 2021
@jreback jreback added Reshaping Concat, Merge/Join, Stack/Unstack, Explode and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Nov 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Reshaping Concat, Merge/Join, Stack/Unstack, Explode
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants