Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Pipeline with one column that compute industry mean of a fundamental (Price to earning or Price to sale)?

Hi, in the research environment, i would like to create a factor that compare the PER ratio of a stock to the one of the industry of which it belongs and subsquently make an action (Sell or buy).
1/ First of all when i run a simple pipeline which compute the PER of each stock in a desire universe, the PER that i get seem to be too to high and surely different from the actual stock PER. Is there any issue with morningstar fundamental data? (Please see notebook cell 13)
2/ Coming to my real obstacles:
a/ The "windowsafe" Issue, i get the windowsafe error if i do not manually set to true all the data used in the custom factor i tried to use for the computation of the mean PER (Per industry).
I would like to know if i may distort the data when setting manually to TRUE (Windowsafe)? if yes how could i handle those data to not end up with distorted data or wrong signals or wrong outputs from the Custom Factor?
NB: Read the windows safe explanation already. But how one could make the data robust instead of manually set them to window safe?

b/The one dimensional error ("Exception: Data must be 1-dimensional") could anyone help me with this? or if there is any way arround this to get to my goal of computing any industry fundamental mean.