quantopian / alphalens

Performance analysis of predictive (alpha) stock factors
http://quantopian.github.io/alphalens
Apache License 2.0
3.26k stars 1.13k forks source link

Keep most recent data #303

Closed jzhang18 closed 6 years ago

jzhang18 commented 6 years ago

Modified the way to drop nan values for merged_data. By this way, it only drops the data that does not have valid factor value or factor_quantile.

luca-s commented 6 years ago

Seems good to me. Just to be sure, Do you need this to avoid dropping data when you have that some forward return columns contain valid data but few of them have nan?

jzhang18 commented 6 years ago

@luca-s yes, that's the reason.

luca-s commented 6 years ago

Ok then but I would also add another dropna that discards all the rows for which we have nan in all the forward return columns. This would make clear the user didn't pass data for a particular time period. What do you think about this?

luca-s commented 6 years ago

@jzhang18 there is also one last thing that makes me nervous about this change (which I like by the way). Since the first release of Alphalens we have had the line merged_data = merged_data.dropna() so the code never had to deal with nans. What kind of tests have you done to verify there are no side effects after this change?

twiecki commented 6 years ago

After talking about it with @jzhang18 we don't think this should be fixed in alphalens.