Closed
Description
By "float reduction", I mean any reduction that would coerce bool or int to float - e.g. mean, std, skew, kurt.
Along with bool and int, we also coerce object to float:
print(pd.DataFrame(data=[[1]], columns=["a"], dtype=object).mean(axis=0))
# a 1.0
# dtype: float64
The reason we cast bool / int to float is to make the resulting dtype not value-dependent. However it's not clear to me if this is the correct thing to do with object. I think I would have expected to get object dtype back.
This was noticed because of the following inconsistency:
print(pd.DataFrame(columns=["a"], dtype=object).mean())
# a NaN
# dtype: object
In the case of an empty frame with columns, we do end up with object dtype.