Skip to content

describe on a groupby #4792

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
hayd opened this issue Sep 9, 2013 · 2 comments
Closed

describe on a groupby #4792

hayd opened this issue Sep 9, 2013 · 2 comments

Comments

@hayd
Copy link
Contributor

hayd commented Sep 9, 2013

I think expected result of this is with multiindex column...

df = pd.DataFrame({'PRICE': {pd.Timestamp('2011-01-06 10:59:05', tz=None): 24990,
  pd.Timestamp('2011-01-06 12:43:33', tz=None): 25499,
  pd.Timestamp('2011-01-06 12:54:09', tz=None): 25499},
 'VOLUME': {pd.Timestamp('2011-01-06 10:59:05', tz=None): 1500000000,
  pd.Timestamp('2011-01-06 12:43:33', tz=None): 5000000000,
  pd.Timestamp('2011-01-06 12:54:09', tz=None): 100000000}})


In [2]: g = df.groupby('PRICE')

In [3]: df.groupby('PRICE').describe()  # expected .unstack(1)
Out[3]: 
             PRICE        VOLUME
PRICE                           
24990 count      1  1.000000e+00
      mean   24990  1.500000e+09
      std      NaN           NaN
      min    24990  1.500000e+09
      25%    24990  1.500000e+09
      50%    24990  1.500000e+09
      75%    24990  1.500000e+09
      max    24990  1.500000e+09
25499 count      2  2.000000e+00
      mean   25499  2.550000e+09
      std        0  3.464823e+09
      min    25499  1.000000e+08
      25%    25499  1.325000e+09
      50%    25499  2.550000e+09
      75%    25499  3.775000e+09
      max    25499  5.000000e+09

cc #4740 @jreback

I guess it just applies method/attribute from df:

In [4]: pd.DataFrame.foo = 1

In [5]: g.foo
Out[5]: 
PRICE
24990    1
25499    1
dtype: int64

In [6]: pd.DataFrame.bar = lambda x: 1

In [7]: g.bar()
Out[7]: 
PRICE
24990    1
25499    1
dtype: int64

should we just special case describe? :s

@jreback
Copy link
Contributor

jreback commented Sep 10, 2013

u could do this like median which is special cased as a python apply I thnk

@jreback
Copy link
Contributor

jreback commented Mar 11, 2014

@hayd if you would like to address this at some point.....but pushing for now

@jreback jreback modified the milestones: 0.16.0, Next Major Release Mar 3, 2015
@jreback jreback modified the milestones: 0.20.0, Next Major Release Jan 30, 2017
mroeschke added a commit to mroeschke/pandas that referenced this issue Feb 1, 2017
Restructure describe def

Fix another test

Refactoring tests

linting & patch groupby tests

add whatsnew
mroeschke added a commit to mroeschke/pandas that referenced this issue Feb 1, 2017
Restructure describe def

Fix another test

Refactoring tests

linting & patch groupby tests

add whatsnew

fix docstring
mroeschke added a commit to mroeschke/pandas that referenced this issue Feb 3, 2017
Restructure describe def

Fix another test

Refactoring tests

linting & patch groupby tests

add whatsnew

fix docstring

fix more tests

Added api example and documentation to describe
mroeschke added a commit to mroeschke/pandas that referenced this issue Feb 3, 2017
Restructure describe def

Fix another test

Refactoring tests

linting & patch groupby tests

add whatsnew

fix docstring

fix more tests

Added api example and documentation to describe

fix potential pep8 complaint
mroeschke added a commit to mroeschke/pandas that referenced this issue Feb 6, 2017
Restructure describe def

Fix another test

Refactoring tests

linting & patch groupby tests

add whatsnew

fix docstring

fix more tests

Added api example and documentation to describe

fix potential pep8 complaint

adjust doc description

renamed original test and add agg example in doc
mroeschke added a commit to mroeschke/pandas that referenced this issue Feb 6, 2017
Restructure describe def

Fix another test

Refactoring tests

linting & patch groupby tests

add whatsnew

fix docstring

fix more tests

Added api example and documentation to describe

fix potential pep8 complaint

adjust doc description

renamed original test and add agg example in doc

simplify example
mroeschke added a commit to mroeschke/pandas that referenced this issue Feb 9, 2017
Restructure describe def

Fix another test

Refactoring tests

linting & patch groupby tests

add whatsnew

fix docstring

fix more tests

Added api example and documentation to describe

fix potential pep8 complaint

adjust doc description

renamed original test and add agg example in doc

simplify example

 Eliminate grouper from result

simplify example in the whatsnew
AnkurDedania pushed a commit to AnkurDedania/pandas that referenced this issue Mar 21, 2017
closes pandas-dev#4792

Author: Matt Roeschke <[email protected]>
Author: Matthew Roeschke <[email protected]>

Closes pandas-dev#15260 from mroeschke/fix_4792 and squashes the following commits:

618bc46 [Matthew Roeschke] Merge branch 'master' into fix_4792
184378d [Matt Roeschke] TST: groupby.describe levels don't appear as column (pandas-dev#4792)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants