-
-
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.NA - MaskedArraysRelated to pd.NA and nullable extension arraysRelated to pd.NA and nullable extension arraysPerformanceMemory or execution speed performanceMemory or execution speed performanceReduction Operationssum, mean, min, max, etc.sum, mean, min, max, etc.
Description
Currently, we cast to float in the IntegerArray reducing ops:
pandas/pandas/core/arrays/integer.py
Lines 673 to 678 in db62039
# coerce to a nan-aware float if needed | |
if mask.any(): | |
data = self._data.astype("float64") | |
data[mask] = self._na_value | |
op = getattr(nanops, "nan" + name) |
However, the nanops
functions can already handle a mask. So with the appropriate fill_value, there should be no need to cast the integers to float (and check for missing values). At least this is the case for skipna=True
, the case of skipna=False
might need to be handled separately.
Metadata
Metadata
Assignees
Labels
ExtensionArrayExtending pandas with custom dtypes or arrays.Extending pandas with custom dtypes or arrays.NA - MaskedArraysRelated to pd.NA and nullable extension arraysRelated to pd.NA and nullable extension arraysPerformanceMemory or execution speed performanceMemory or execution speed performanceReduction Operationssum, mean, min, max, etc.sum, mean, min, max, etc.