|
80 | 80 | 'mean', 'sum', 'min', 'max',
|
81 | 81 | 'cumcount',
|
82 | 82 | 'resample',
|
83 |
| - 'describe', |
84 | 83 | 'rank', 'quantile',
|
85 | 84 | 'fillna',
|
86 | 85 | 'mad',
|
@@ -854,7 +853,7 @@ def _wrap_applied_output(self, *args, **kwargs):
|
854 | 853 | raise AbstractMethodError(self)
|
855 | 854 |
|
856 | 855 | def _concat_objects(self, keys, values, not_indexed_same=False):
|
857 |
| - from pandas.tools.merge import concat |
| 856 | + from pandas.tools.concat import concat |
858 | 857 |
|
859 | 858 | def reset_identity(values):
|
860 | 859 | # reset the identities of the components
|
@@ -1138,6 +1137,16 @@ def ohlc(self):
|
1138 | 1137 | return self._apply_to_column_groupbys(
|
1139 | 1138 | lambda x: x._cython_agg_general('ohlc'))
|
1140 | 1139 |
|
| 1140 | + @Appender(DataFrame.describe.__doc__) |
| 1141 | + @Substitution(name='groupby') |
| 1142 | + @Appender(_doc_template) |
| 1143 | + def describe(self, **kwargs): |
| 1144 | + self._set_group_selection() |
| 1145 | + result = self.apply(lambda x: x.describe(**kwargs)) |
| 1146 | + if self.axis == 1: |
| 1147 | + return result.T |
| 1148 | + return result.unstack() |
| 1149 | + |
1141 | 1150 | @Substitution(name='groupby')
|
1142 | 1151 | @Appender(_doc_template)
|
1143 | 1152 | def resample(self, rule, *args, **kwargs):
|
@@ -3039,6 +3048,14 @@ def nlargest(self, n=5, keep='first'):
|
3039 | 3048 | def nsmallest(self, n=5, keep='first'):
|
3040 | 3049 | return self.apply(lambda x: x.nsmallest(n=n, keep=keep))
|
3041 | 3050 |
|
| 3051 | + @Appender(Series.describe.__doc__) |
| 3052 | + def describe(self, **kwargs): |
| 3053 | + self._set_group_selection() |
| 3054 | + result = self.apply(lambda x: x.describe(**kwargs)) |
| 3055 | + if self.axis == 1: |
| 3056 | + return result.T |
| 3057 | + return result.unstack() |
| 3058 | + |
3042 | 3059 | def value_counts(self, normalize=False, sort=True, ascending=False,
|
3043 | 3060 | bins=None, dropna=True):
|
3044 | 3061 |
|
@@ -3507,7 +3524,7 @@ def first_non_None_value(values):
|
3507 | 3524 | # still a series
|
3508 | 3525 | # path added as of GH 5545
|
3509 | 3526 | elif all_indexed_same:
|
3510 |
| - from pandas.tools.merge import concat |
| 3527 | + from pandas.tools.concat import concat |
3511 | 3528 | return concat(values)
|
3512 | 3529 |
|
3513 | 3530 | if not all_indexed_same:
|
@@ -3540,7 +3557,7 @@ def first_non_None_value(values):
|
3540 | 3557 | else:
|
3541 | 3558 | # GH5788 instead of stacking; concat gets the
|
3542 | 3559 | # dtypes correct
|
3543 |
| - from pandas.tools.merge import concat |
| 3560 | + from pandas.tools.concat import concat |
3544 | 3561 | result = concat(values, keys=key_index,
|
3545 | 3562 | names=key_index.names,
|
3546 | 3563 | axis=self.axis).unstack()
|
@@ -3588,7 +3605,7 @@ def first_non_None_value(values):
|
3588 | 3605 | not_indexed_same=not_indexed_same)
|
3589 | 3606 |
|
3590 | 3607 | def _transform_general(self, func, *args, **kwargs):
|
3591 |
| - from pandas.tools.merge import concat |
| 3608 | + from pandas.tools.concat import concat |
3592 | 3609 |
|
3593 | 3610 | applied = []
|
3594 | 3611 | obj = self._obj_with_exclusions
|
@@ -3980,7 +3997,7 @@ def _iterate_column_groupbys(self):
|
3980 | 3997 | exclusions=self.exclusions)
|
3981 | 3998 |
|
3982 | 3999 | def _apply_to_column_groupbys(self, func):
|
3983 |
| - from pandas.tools.merge import concat |
| 4000 | + from pandas.tools.concat import concat |
3984 | 4001 | return concat(
|
3985 | 4002 | (func(col_groupby) for _, col_groupby
|
3986 | 4003 | in self._iterate_column_groupbys()),
|
@@ -4061,7 +4078,7 @@ def groupby_series(obj, col=None):
|
4061 | 4078 | if isinstance(obj, Series):
|
4062 | 4079 | results = groupby_series(obj)
|
4063 | 4080 | else:
|
4064 |
| - from pandas.tools.merge import concat |
| 4081 | + from pandas.tools.concat import concat |
4065 | 4082 | results = [groupby_series(obj[col], col) for col in obj.columns]
|
4066 | 4083 | results = concat(results, axis=1)
|
4067 | 4084 |
|
|
0 commit comments