@@ -7089,6 +7089,9 @@ def quantile(self, q=0.5, axis=0, numeric_only=True,
7089
7089
0 <= q <= 1, the quantile(s) to compute
7090
7090
axis : {0, 1, 'index', 'columns'} (default 0)
7091
7091
0 or 'index' for row-wise, 1 or 'columns' for column-wise
7092
+ numeric_only : boolean, default True
7093
+ If False, the quantile of datetime and timedelta data will be
7094
+ computed as well
7092
7095
interpolation : {'linear', 'lower', 'higher', 'midpoint', 'nearest'}
7093
7096
.. versionadded:: 0.18.0
7094
7097
@@ -7116,7 +7119,7 @@ def quantile(self, q=0.5, axis=0, numeric_only=True,
7116
7119
--------
7117
7120
7118
7121
>>> df = pd.DataFrame(np.array([[1, 1], [2, 10], [3, 100], [4, 100]]),
7119
- columns=['a', 'b'])
7122
+ columns=['a', 'b'])
7120
7123
>>> df.quantile(.1)
7121
7124
a 1.3
7122
7125
b 3.7
@@ -7126,6 +7129,20 @@ def quantile(self, q=0.5, axis=0, numeric_only=True,
7126
7129
0.1 1.3 3.7
7127
7130
0.5 2.5 55.0
7128
7131
7132
+ Specifying `numeric_only=False` will also compute the quantile of
7133
+ datetime and timedelta data.
7134
+
7135
+ >>> df = pd.DataFrame({'A': [1, 2],
7136
+ 'B': [pd.Timestamp('2010'),
7137
+ pd.Timestamp('2011')],
7138
+ 'C': [pd.Timedelta('1 days'),
7139
+ pd.Timedelta('2 days')]})
7140
+ >>> df.quantile(0.5, numeric_only=False)
7141
+ A 1.5
7142
+ B 2010-07-02 12:00:00
7143
+ C 1 days 12:00:00
7144
+ Name: 0.5, dtype: object
7145
+
7129
7146
See Also
7130
7147
--------
7131
7148
pandas.core.window.Rolling.quantile
0 commit comments