-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
Closed
Labels
ExtensionArrayExtending pandas with custom dtypes or arrays.Extending pandas with custom dtypes or arrays.Needs TestsUnit test(s) needed to prevent regressionsUnit test(s) needed to prevent regressions
Description
In our case this arose via .cumsum()
:
pd.Series([0, 1], dtype='int64').cumsum()
0 0
1 1
dtype: int64
pd.Series([0, 1], dtype='Int64').cumsum()
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-31-2ebc3e3cf698> in <module>
----> 1 pd.Series([0, 1], dtype='Int64').cumsum()
...
~/model/.venv/lib/python3.7/site-packages/pandas/core/generic.py in na_accum_func(blk_values)
11324 np.putmask(result, mask, mask_b)
11325 else:
> 11326 result = accum_func(blk_values.T, axis)
11327
11328 # transpose back for ndarray, not for EA
AttributeError: 'IntegerArray' object has no attribute 'T'
But it's also true that just calling .values.T
on a regular int
array works (just a no-op), whereas on an Int64
array it does not. Same is true for
Any reason not to just add a no-op .T
on the base ExtensionArray class..? cc @TomAugspurger in case you have an opinion 🙂
shaunc, MishaVeldhoen, davemkirk and keiv-fly
Metadata
Metadata
Assignees
Labels
ExtensionArrayExtending pandas with custom dtypes or arrays.Extending pandas with custom dtypes or arrays.Needs TestsUnit test(s) needed to prevent regressionsUnit test(s) needed to prevent regressions