Home > database >  Decile Ranking for Time-Series in Pandas Dataframe
Decile Ranking for Time-Series in Pandas Dataframe

Time:01-04

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:

enter image description here

I'm not sure if I'm explaining this well, but I ultimately want to produce a dataframe that looks as follows:

enter image description here

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)
  •  Tags:  
  • Related