Back to Community
Quantiles calculated with quantile classifier are different from those calculated by pandas' qcut

Hello,

I am a newbie and I tried to calculate quintiles of yearly returns but got an output that I cannot understand. May I ask your help?

Please find below my questions:

  1. Does the method .quintiles of every factor calculate quintiles of a given factor daily?
  2. It seems that Returns(window_length=252).quintiles() produces quintiles that contain uneven number of stocks. How is this possible?
  3. If I try to calculate returns' quintiles using pandas' qcut function I get different quintile labels. Why does this happen?

I attach a notebook that's useful to present my questions.

What I am misunderstanding here?

Thanks in advance.

Loading notebook preview...
Notebook previews are currently unavailable.
1 response

I think I found the answer: I did not understand how to use the mask parameter of factors so in my pipeline I computed quintiles using returns for every stock in the data (I did not mask using my universe) and I compared these quintiles with those I could compute using the screened output of my pipeline.

Masking correctly my factor solved my problem.

Thanks.