9951 explained code solutions for 126 technologies


python-pandasHow to calculate 90th percentile for dataframe


import pandas as pd

data = pd.DataFrame({
  'Phone': ['ip5', 'ip6', 'ip8', 'sms', 'xi'],
  'Phone Price': [204, 304, 404, 405, 305]
})

q = data['Phone Price'].quantile(0.9)ctrl + c
import pandas as pd

load Pandas module

data

will contain loaded DataFrame

.quantile(

calculates specified quantile (percentile)

'Phone Price'

column to calculate quantile (percentile) for

0.9

will calculate 90% percentile