reciprocalspaceship
reciprocalspaceship copied to clipboard
`rs.DataSet.reset_index()` call signature does not match pandas >1.5
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
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.