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

rs.DataSet.reset_index() call signature does not match pandas >1.5 #223

Open
kmdalton opened this issue Sep 7, 2023 · 1 comment
Open
Assignees
Labels
API Interface Decisions bug Something isn't working version Version issues

Comments

@kmdalton
Copy link
Member

kmdalton commented Sep 7, 2023

With pandas version 2.0.3 and rs 1.0.1, calling reset_index on a DataSeries instance leads to a type error.

[nav] In [18]: rs.DataSeries(range(10)).reset_index()
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[18], line 1
----> 1 rs.DataSeries(range(10)).reset_index()

File ~/opt/anaconda/envs/careless/lib/python3.11/site-packages/pandas/core/series.py:1618, in Series.reset_index(self, level, drop, name, inplace, allow_duplicates)
   1615             name = self.name
   1617     df = self.to_frame(name)
-> 1618     return df.reset_index(
   1619         level=level, drop=drop, allow_duplicates=allow_duplicates
   1620     )
   1621 return None

TypeError: DataSet.reset_index() got an unexpected keyword argument 'allow_duplicates'

This doesn't happen with the underlying pandas Series object:

[nav] In [19]: pd.Series(range(10)).reset_index()
Out[19]: 
   index  0
0      0  0
1      1  1
2      2  2
3      3  3
4      4  4
5      5  5
6      6  6
7      7  7
8      8  8
9      9  9
@JBGreisman JBGreisman changed the title rs.DataSeries.reset_index TypeError rs.DataSet.reset_index() call signature does not match pandas >1.5 Sep 15, 2023
@JBGreisman JBGreisman added bug Something isn't working API Interface Decisions version Version issues labels Sep 15, 2023
@JBGreisman
Copy link
Member

Although the example given uses rs.DataSeries, this is really an issue with the call signature for rs.DataSet.reset_index() (this can be seen in the TypeError message in the provided example). When rs.DataSeries.reset_index() is called without drop=True, it automatically converts to a rs.DataSet, leading to this issue.

There were changes to the API of reset_index() in pandas >1.5, so we will need to update our codebase to be compatible with the new call signatures.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Interface Decisions bug Something isn't working version Version issues
Projects
None yet
Development

No branches or pull requests

2 participants