Repository: pandas-dev/pandas

Issue:
DataFrame Quantile Broken with Datetime Data
This works fine:
```python
In [17]: pd.Series(pd.date_range('1/1/18', periods=5)).quantile()                                                                          
Out[17]: Timestamp('2018-01-03 00:00:00')
```

But the equivalent method with a DataFrame raises:

```python-traceback
In [18]: pd.DataFrame(pd.date_range('1/1/18', periods=5)).quantile()                                                                       
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-18-68ffc067f6f0> in <module>
----> 1 pd.DataFrame(pd.date_range('1/1/18', periods=5)).quantile()

~/clones/pandas/pandas/core/frame.py in quantile(self, q, axis, numeric_only, interpolation)
   7569                                      axis=1,
   7570                                      interpolation=interpolation,
-> 7571                                      transposed=is_transposed)
   7572 
   7573         if result.ndim == 2:

~/clones/pandas/pandas/core/internals/managers.py in quantile(self, **kwargs)
    500 
    501     def quantile(self, **kwargs):
--> 502         return self.reduction('quantile', **kwargs)
    503 
    504     def setitem(self, **kwargs):

~/clones/pandas/pandas/core/internals/managers.py in reduction(self, f, axis, consolidate, transposed, **kwargs)
    473 
    474         # single block
--> 475         values = _concat._concat_compat([b.values for b in blocks])
    476 
    477         # compute the orderings of our original data

~/clones/pandas/pandas/core/dtypes/concat.py in _concat_compat(to_concat, axis)
    172                 to_concat = [x.astype('object') for x in to_concat]
    173 
--> 174     return np.concatenate(to_concat, axis=axis)
    175 
    176 

ValueError: need at least one array to concatenate
```

#### Expected Output

The DataFrame should return just as Series does

#### Output of ``pd.show_versions()``

<details>

INSTALLED VERSIONS
------------------
commit: 07b0c003db22daf79f87f5d095a4edc2659e1bac
python: 3.6.7.final.0
python-bits: 64
OS: Darwin
OS-release: 18.2.0
machine: x86_64
processor: i386
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: en_US.UTF-8

pandas: 0.24.0.dev0+1150.g07b0c003d.dirty
pytest: 4.0.0
pip: 18.1
setuptools: 40.6.2
Cython: 0.29
numpy: 1.15.4
scipy: 1.1.0
pyarrow: 0.11.1
xarray: 0.11.0
IPython: 7.1.1
sphinx: 1.8.2
patsy: 0.5.1
dateutil: 2.7.5
pytz: 2018.7
blosc: None
bottleneck: 1.2.1
tables: 3.4.4
numexpr: 2.6.8
feather: None
matplotlib: 3.0.1
openpyxl: 2.5.9
xlrd: 1.1.0
xlwt: 1.2.0
xlsxwriter: 1.1.2
lxml: 4.2.5
bs4: 4.6.3
html5lib: 1.0.1
sqlalchemy: 1.2.14
pymysql: 0.9.2
psycopg2: None
jinja2: 2.10
s3fs: 0.1.6
fastparquet: 0.1.6
pandas_gbq: None
pandas_datareader: None
gcsfs: 0.2.0

</details>



Discussion:
It appears that `DataFrame.quantile()` has a default of `numeric_only=True`, which `Series.quantile()` does not have:
```
In [5]: pd.DataFrame(pd.date_range('1/1/18', periods=5)).quantile(numeric_only=False)
Out[5]: 0   2018-01-03
        Name: 0.5, dtype: datetime64[ns]
```
Looks like this is a duplicate of #18608 - I'd be in favor of resolving by deprecating this flag.

Resolving patch:
diff --git a/pandas/core/frame.py b/pandas/core/frame.py
--- a/pandas/core/frame.py
+++ b/pandas/core/frame.py
@@ -8245,6 +8245,13 @@ def quantile(self, q=0.5, axis=0, numeric_only=True, interpolation="linear"):
         if is_transposed:
             data = data.T
 
+        if len(data.columns) == 0:
+            # GH#23925 _get_numeric_data may have dropped all columns
+            cols = Index([], name=self.columns.name)
+            if is_list_like(q):
+                return self._constructor([], index=q, columns=cols)
+            return self._constructor_sliced([], index=cols, name=q)
+
         result = data._data.quantile(
             qs=q, axis=1, interpolation=interpolation, transposed=is_transposed
         )


Test patch:
diff --git a/pandas/tests/frame/test_quantile.py b/pandas/tests/frame/test_quantile.py
--- a/pandas/tests/frame/test_quantile.py
+++ b/pandas/tests/frame/test_quantile.py
@@ -439,7 +439,7 @@ def test_quantile_nat(self):
         )
         tm.assert_frame_equal(res, exp)
 
-    def test_quantile_empty(self):
+    def test_quantile_empty_no_rows(self):
 
         # floats
         df = DataFrame(columns=["a", "b"], dtype="float64")
@@ -467,3 +467,17 @@ def test_quantile_empty(self):
 
         # FIXME (gives NaNs instead of NaT in 0.18.1 or 0.19.0)
         # res = df.quantile(0.5, numeric_only=False)
+
+    def test_quantile_empty_no_columns(self):
+        # GH#23925 _get_numeric_data may drop all columns
+        df = pd.DataFrame(pd.date_range("1/1/18", periods=5))
+        df.columns.name = "captain tightpants"
+        result = df.quantile(0.5)
+        expected = pd.Series([], index=[], name=0.5)
+        expected.index.name = "captain tightpants"
+        tm.assert_series_equal(result, expected)
+
+        result = df.quantile([0.5])
+        expected = pd.DataFrame([], index=[0.5], columns=[])
+        expected.columns.name = "captain tightpants"
+        tm.assert_frame_equal(result, expected)