Skip to content Skip to sidebar Skip to footer

Quintiles Error

This is my dataframe: Date AAPL NFLX INTC AAPL_Ret NFLX_Ret INTC_Ret 0 2008-01-31 27.834286 3.764286 25.350000 1 2008-02-29 27.847143 3.72

Solution 1:

The problem is, pd.qcut function accepts 1d array and you are passing a data frame. Instead, you can do something like:

for col in df.columns:
    if '_Ret' in col:
        df[col+'_quantile'] = pd.qcut(df[col], 5, labels=list(range(5,0,-1)))

Post a Comment for "Quintiles Error"