Back to Community
Error with deprecated code

I've modified an old algo with some additional factors and new rankings. The rebalance function of the algo contains a deprecated line of code that runs an d completes with a WARN before May/31/2017, but fails any date after May/31/2017.

Here the lines:
print slopes.order(ascending=False).head(100)
ranking_table = slopes[slopes > slopes.quantile(1 - context.rank_table_percentile)].order(ascending=False)

Here are the WARN I'm getting, when the end-date is set to on before May/31/2017:

016-01-04 15:00 WARN :185: FutureWarning: order is deprecated, use sort_values(...)
2016-01-04 15:00 WARN :187: FutureWarning: order is deprecated, use sort_values(...)

Here are the errors I'm getting when the end-date is set to after May/31/2017,

AttributeError: 'DataFrame' object has no attribute 'order'

I've update the line with the following:
ranking_table = slopes[slopes > slopes.quantile(1 - context.rank_table_percentile)].sort_values(ascending=False)

This didn't work. Any help would be appreciated.


1 response

It seems like the error is telling you somewhere in the code '.order' is being appended to a dataframe object. It thinks that '.order' is trying to reference an attribute of that dataframe object but a dataframe doesn't have such an attribute. The error should indicate a line number where it thinks the problem is. If not, simply search your code (using the browser 'find' feature) for all occurrences of 'order'. That should point you to the problem.