-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
Closed
Labels
BugDataFrameDataFrame data structureDataFrame data structureDtype ConversionsUnexpected or buggy dtype conversionsUnexpected or buggy dtype conversionsReduction Operationssum, mean, min, max, etc.sum, mean, min, max, etc.
Description
In pandas 1.5.x and before, the dtype of the result is different when using axis=1
:
df = pd.DataFrame({'a': [1, 2, 3], 'b': [4, 5, 6]}, dtype=object)
print(df.sum(axis=1, numeric_only=None))
print(df.sum(axis=1, numeric_only=False))
0 5.0
1 7.0
2 9.0
dtype: float64
0 5
1 7
2 9
dtype: object
When using axis=0
, both the examples above result in object dtype. #49551 changed the numeric_only=False
case to return float64
in order to preserve the default behavior. However, it seems better to have the result be object dtype for both examples above instead.
Metadata
Metadata
Assignees
Labels
BugDataFrameDataFrame data structureDataFrame data structureDtype ConversionsUnexpected or buggy dtype conversionsUnexpected or buggy dtype conversionsReduction Operationssum, mean, min, max, etc.sum, mean, min, max, etc.