Example DataFrame Values -
0 78
1 38
2 42
3 48
4 31
5 89
6 94
7 102
8 122
9 122
stats.percentileofscore(temp[\'INCOME\'].v
Let's consider the below dataframe:
DataFrame
In order to get the percentile of a column in pandas Dataframe we use the following code:
survey['Nationality'].value_counts(normalize='index')
Output:
USA 0.333333
China 0.250000
India 0.250000
Bangadesh 0.166667
Name: Nationality, dtype: float64
In order to get the percentile of a column in pandas Dataframe with respect to another categorical column
pd.crosstab(survey.Sex,survey.Handedness,normalize = 'index')
The output would be something like given below
Output