I have a pandas dataframe that looks like the below, and I am trying to obtain the decile ranking for each column's row and then create a new column for each feature within the dataframe:
I'm not sure if I'm explaining this well, but I ultimately want to produce a dataframe that looks as follows:
CodePudding user response:
You can use qcut - https://pandas.pydata.org/docs/reference/api/pandas.qcut.html
df['a_decile'] = pd.qcut(df['a'], 10, labels = False)