Skip to content
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

BUG: Series.explode ignores ignore_index parameter when series is not a nested type #40487

Closed
2 tasks done
isVoid opened this issue Mar 17, 2021 · 2 comments
Closed
2 tasks done
Labels
Bug Reshaping Concat, Merge/Join, Stack/Unstack, Explode
Milestone

Comments

@isVoid
Copy link
Contributor

isVoid commented Mar 17, 2021

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

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


>>> s = pd.Series([1, 2], index=['a', 'b'])
>>> s.explode(ignore_index=True)
a    1
b    2
dtype: int64

Problem description

Even though exploding a non-nested array results in a no-op. ignore_index should still be considered to align with behavior of its dataframe sibling.

Expected Output

>>> s.explode(ignore_index=True)
0    1
1    2
dtype: int64

Output of pd.show_versions()

INSTALLED VERSIONS

commit : 3e89b4c
python : 3.7.10.final.0
python-bits : 64
OS : Linux
OS-release : 4.15.0-76-generic
Version : #86-Ubuntu SMP Fri Jan 17 17:24:28 UTC 2020
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : None
LOCALE : en_US.UTF-8

pandas : 1.2.0
numpy : 1.20.1
pytz : 2021.1
dateutil : 2.8.1
pip : 21.0.1
setuptools : 52.0.0.post20210125
Cython : 0.29.22
pytest : 6.2.2
hypothesis : 6.8.0
sphinx : 3.5.2
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 2.11.3
IPython : 7.21.0
pandas_datareader: None
bs4 : None
bottleneck : None
fsspec : 0.8.7
fastparquet : None
gcsfs : None
matplotlib : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : 1.0.1
pyxlsb : None
s3fs : None
scipy : None
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
numba : 0.52.0

@isVoid isVoid added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Mar 17, 2021
@dsaxton dsaxton added Reshaping Concat, Merge/Join, Stack/Unstack, Explode and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Mar 18, 2021
@dsaxton dsaxton added this to the 1.3 milestone Mar 18, 2021
@phofl
Copy link
Member

phofl commented Apr 2, 2021

@dsaxton This issue was not closed. It looks like it was missed when the pr was merged?

@dsaxton
Copy link
Member

dsaxton commented Apr 2, 2021

Yeah, not sure why this wasn't closed automatically. Thanks @phofl.

@dsaxton dsaxton closed this as completed Apr 2, 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

No branches or pull requests

3 participants