diff --git a/tests/metrics/test_metrics.py b/tests/metrics/test_metrics.py index ececf7559f..ae0a60f19f 100644 --- a/tests/metrics/test_metrics.py +++ b/tests/metrics/test_metrics.py @@ -1,5 +1,4 @@ import unittest -import warnings import numpy as np import pandas as pd @@ -117,11 +116,7 @@ def init_class_fixtures(cls): cls.closes.name = None def test_nop(self): - # Filter out pandas `ix` DeprecationWarning causing tests to fail - with warnings.catch_warnings(): - warnings.simplefilter("ignore", DeprecationWarning) - - perf = self.run_algorithm() + perf = self.run_algorithm() zeros = pd.Series(0.0, index=self.closes) all_zero_fields = [ @@ -451,13 +446,10 @@ def handle_data(context, data): check_portfolio(context) context.bar_count += 1 - # Filter out pandas `ix` DeprecationWarning causing tests to fail - with warnings.catch_warnings(): - warnings.simplefilter("ignore", DeprecationWarning) - perf = self.run_algorithm( - initialize=initialize, - handle_data=handle_data, - ) + perf = self.run_algorithm( + initialize=initialize, + handle_data=handle_data, + ) first_day_returns = -( abs(per_fill_commission.sum()) / self.SIM_PARAMS_CAPITAL_BASE @@ -608,13 +600,10 @@ def handle_data(context, data): # the portfolio on the bar of the order, only the following bars check_portfolio(context, first_bar) - # Filter out pandas `ix` DeprecationWarning causing tests to fail - with warnings.catch_warnings(): - warnings.simplefilter("ignore", DeprecationWarning) - perf = self.run_algorithm( - initialize=initialize, - handle_data=handle_data, - ) + perf = self.run_algorithm( + initialize=initialize, + handle_data=handle_data, + ) zeros = pd.Series(0.0, index=self.closes) all_zero_fields = [ @@ -1026,13 +1015,10 @@ def handle_data(context, data): # the portfolio on the bar of the order, only the following bars check_portfolio(context, first_bar) - # Filter out pandas `ix` DeprecationWarning causing tests to fail - with warnings.catch_warnings(): - warnings.simplefilter("ignore", DeprecationWarning) - perf = self.run_algorithm( - initialize=initialize, - handle_data=handle_data, - ) + perf = self.run_algorithm( + initialize=initialize, + handle_data=handle_data, + ) zeros = pd.Series(0.0, index=self.closes) all_zero_fields = [ @@ -1585,14 +1571,10 @@ def handle_data(context, data): # the portfolio on the bar of the order, only the following bars check_portfolio(data, context, first_bar) - # Filter out pandas `ix` DeprecationWarning causing tests to fail - with warnings.catch_warnings(): - warnings.simplefilter("ignore", DeprecationWarning) - - perf = self.run_algorithm( - initialize=initialize, - handle_data=handle_data, - ) + perf = self.run_algorithm( + initialize=initialize, + handle_data=handle_data, + ) zeros = pd.Series(0.0, index=self.equity_closes) all_zero_fields = [ @@ -2006,16 +1988,12 @@ def handle_data(context, data): # the portfolio on the bar of the order, only the following bars check_portfolio(data, context, first_bar) - # Filter out pandas `ix` DeprecationWarning causing tests to fail - with warnings.catch_warnings(): - warnings.simplefilter("ignore", DeprecationWarning) - - perf = self.run_algorithm( - initialize=initialize, - handle_data=handle_data, - trading_calendar=self.trading_calendars[Future], - data_portal=self.futures_data_portal, - ) + perf = self.run_algorithm( + initialize=initialize, + handle_data=handle_data, + trading_calendar=self.trading_calendars[Future], + data_portal=self.futures_data_portal, + ) zeros = pd.Series(0.0, index=self.future_closes) all_zero_fields = [ diff --git a/zipline/algorithm.py b/zipline/algorithm.py index be6c3a23b6..991067582a 100644 --- a/zipline/algorithm.py +++ b/zipline/algorithm.py @@ -490,7 +490,7 @@ def _create_clock(self): """ If the clock property is not set, then create one based on frequency. """ - trading_o_and_c = self.trading_calendar.schedule.ix[ + trading_o_and_c = self.trading_calendar.schedule.loc[ self.sim_params.sessions] market_closes = trading_o_and_c['market_close'] minutely_emission = False