I want to get a percentage of a particular value in a df column. Say I have a df with (col1, col2 , col3, gender) gender column has values of M or F. I want to get the perc
g = data[Target_col_Y]
df = pd.concat([g.value_counts(),
g.value_counts(normalize=True).mul(100)],axis=1,keys=('counts','percentage'))
print (df)
counts percentage
0 36548 88.734583
1 4640 11.265417
df1=df.diff(periods=1,axis=0)
difvalue=df1[[list(df1.columns)[-1]]].max()