API: Make describe changes backwards compatible by TomAugspurger · Pull Request #34798 · pandas-dev/pandas (original) (raw)

@jorisvandenbossche can you remind me what the dataframe issue is? That datetimes are not included in this output while timedeltas are?

In [4]: pd.DataFrame({'a': pd.date_range("2012", periods=3), 'b': [1, 2, 3]}).describe() ...: Out[4]: b count 3.0 mean 2.0 std 1.0 min 1.0 25% 1.5 50% 2.0 75% 2.5 max 3.0

In [6]: pd.DataFrame({'a': pd.timedelta_range("2012", periods=3), 'b': [1, 2, 3]}).describe() ...: Out[6]: a b count 3 3.0 mean 1 days 00:00:00.000002012 2.0 std 1 days 00:00:00 1.0 min 0 days 00:00:00.000002012 1.0 25% 0 days 12:00:00.000002012 1.5 50% 1 days 00:00:00.000002012 2.0 75% 1 days 12:00:00.000002012 2.5 max 2 days 00:00:00.000002012 3.0

Interestingly if you have datetime, numeric, and timedelta, then the timedelta is not included:

In [5]: pd.DataFrame({'a': pd.date_range("2012", periods=3), 'b': [1, 2, 3], 'c': pd.period_range('2000', periods=3)}).describe() ...: Out[5]: b count 3.0 mean 2.0 std 1.0 min 1.0 25% 1.5 50% 2.0 75% 2.5 max 3.0

This all seems buggy, but I hope can be handled separately.