Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAINT: code refactoring to make it compatible with pandas 0.23.4 #328

Merged
merged 1 commit into from
Dec 17, 2018

Conversation

luca-s
Copy link
Collaborator

@luca-s luca-s commented Dec 16, 2018

Added freq argument to plot.plot_cumulative_returns and plot.plot_cumulative_returns_by_quantile, which allow to avoid settings the index frequency inside perf.to_weights and perf.factor_returns (which in turn causes pandas 0.23.4 to crash, see #319 )

Also this closes #319

@@ -724,6 +724,11 @@ def plot_cumulative_returns(factor_returns, period, title=None, ax=None):
Length of period for which the returns are computed (e.g. 1 day)
if 'period' is a string it must follow pandas.Timedelta constructor
format (e.g. '1 days', '1D', '30m', '3h', '1D1h', etc)
freq : pandas DateOffset
Used to specify a particular trading calendar e.g. BusinessDay or Day
Usually this is inferred from utils.infer_trading_calendar, which is
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's inferred, why is it a required argument?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because plot_cumulative_returns doesn't receive factor_data in input, which has the inferred trading calendar.

@twiecki
Copy link
Contributor

twiecki commented Dec 17, 2018

wasn't there a commit to add newer pandas to travis?

@luca-s
Copy link
Collaborator Author

luca-s commented Dec 17, 2018

wasn't there a commit to add newer pandas to travis?

Yes, but I removed it because there are changes in pandas 0.23.4 that conflict with pandas 0.18.1 and some tests fail. Those tests are not that meaningful, e.g. some nans are returned as 0s in new pandas and some indices need to be Categorical. Anyway I didn't want to chase what changed internally in pandas, so when we get rid of pandas 0.18.1 we can update the tests for new pandas versions.

@twiecki twiecki merged commit 957d5cc into quantopian:master Dec 17, 2018
@twiecki
Copy link
Contributor

twiecki commented Dec 17, 2018

Thanks @luca-s!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inferred frequency does not conform In Calculating TEARS (Pandas 0.23.4 issue)
2 participants