BUG: Empty DataFrame(..., dtype='datetime64[ns]').quantile(..., axis=1) returns float64 dtype · Issue #41544 · pandas-dev/pandas (original) (raw)

In [1]: df = DataFrame(columns=["a", "b"], dtype="datetime64[ns]")

In [2]: df
Out[2]:
Empty DataFrame
Columns: [a, b]
Index: []

In [3]: df.quantile(0.5, axis=1, numeric_only=False)
Out[3]: Series([], Name: 0.5, dtype: float64)

In [4]: df.quantile(0.5, axis=1, numeric_only=False).dtype
Out[4]: dtype('float64')

In [5]: df
Out[5]:
Empty DataFrame
Columns: [a, b]
Index: []

In [6]: df.T
Out[6]:
Empty DataFrame
Columns: []
Index: [a, b]

# Probably the reason why we might get float64 dtype afterwards
In [7]: df.T.dtypes
Out[7]: Series([], dtype: object)