Hi all,
Although new to Quantopian, I am now well underway to make my first real contest entry. I am however stuck on one specific point codewise: How to recode a variable in the pipeline, with the new values based on certain conditions. Below I have attached a simple notebook to clarify the problem:
If the number of positive stocktwits messages is more than 0 I want the 'score' variable to reflect the number of messages, whereas if the number of messages equals to 0 I want the 'score' variable for that stock to have a different value (in this case i picked 2 as an example).
I have tried to accomplish this by using an if statement, however this does not seem to work (as can be seen in the head() output in the notebook, the score still shows zeros). Is there a way to make the if statement functional, or alternatively is there another way I can achieve this?
Thanks!