Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

pandas groupby aggregate quantile

# 50th Percentile
def q50(x):
    return x.quantile(0.5)

# 90th Percentile
def q90(x):
    return x.quantile(0.9)

my_DataFrame.groupby(['AGGREGATE']).agg({'MY_COLUMN': [q50, q90, 'max']})
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #pandas #groupby #aggregate #quantile
ADD COMMENT
Topic
Name
8+3 =