Description
In PR #14536, I added some tests in comments, as they currently fail or give inconsistent results:
1. Empty frame with float dtype:
df = DataFrame(columns=['a', 'b'], dtype='float64')
df.quantile(0.5)
df.quantile(0.5, axis=1)
In 0.18.1, this gives NaNs or empty frame depending on the axis (which is correct I think):
In [10]: df.quantile(0.5)
Out[10]:
a NaN
b NaN
dtype: float64
In [9]: df.quantile(0.5, axis=1)
Out[9]:
Empty DataFrame
Columns: []
Index: []
But on master, the axis=1
case errors (df.quantile(0.5) also gives NaNs):
master:
In [8]: df.quantile(0.5, axis=1)
...
ValueError: need at least one array to concatenate
2. Empty frame with int dtype
df = DataFrame(columns=['a', 'b'], dtype='int64')
df.quantile(0.5)
Opposed to float dtype giving a series of NaNs, with integers it gives an empty frame in 0.18.1:
In [11]: df.quantile(0.5)
Out[11]:
Empty DataFrame
Columns: []
Index: []
and on master also raises the ValueError as for float with axis=1
:
In [14]: df.quantile(0.5)
...
ValueError: need at least one array to concatenate
3. Empty frame with datetime values
df = DataFrame(columns=['a', 'b'], dtype='datetime64')
df.quantile(0.5, numeric_only=False)
On 0.18.1 / master, it gives a series of NaNs, where this should be NaTs:
In [13]: df.quantile(0.5, numeric_only=False)
Out[13]:
a NaN
b NaN
Name: 0.5, dtype: float64
4. Frame with only only datetime columns but without only_numeric=False
df = DataFrame({'a': pd.to_datetime(['2010', '2011']), 'b': [0, 5], 'c': pd.to_datetime(['2011', '2012'])})
df[['a', 'c']].quantile(.5)
On 0.18.1, this gives an empty frame
In [8]: df[['a', 'c']].quantile(.5)
Out[8]:
Empty DataFrame
Columns: []
Index: []
while on master this raises the same ValueError as above:
In [7]: df[['a', 'c']].quantile(.5)
...
ValueError: need at least one array to concatenate