diff --git a/pyfolio/plotting.py b/pyfolio/plotting.py index bd340136..052c3195 100644 --- a/pyfolio/plotting.py +++ b/pyfolio/plotting.py @@ -645,7 +645,7 @@ def show_perf_stats(returns, factor_returns=None, positions=None, perf_stats = pd.DataFrame(perf_stats_all, columns=['Backtest']) for column in perf_stats.columns: - for stat, value in perf_stats[column].iteritems(): + for stat, value in perf_stats[column].items(): if stat in STAT_FUNCS_PCT: perf_stats.loc[stat, column] = str(np.round(value * 100, 3)) + '%' diff --git a/pyfolio/round_trips.py b/pyfolio/round_trips.py index 05c2eaad..8a0f9cfa 100644 --- a/pyfolio/round_trips.py +++ b/pyfolio/round_trips.py @@ -301,7 +301,7 @@ def add_closing_transactions(positions, transactions): # they don't conflict with other round_trips executed at that time. end_dt = open_pos.name + pd.Timedelta(seconds=1) - for sym, ending_val in open_pos.iteritems(): + for sym, ending_val in open_pos.items(): txn_sym = transactions[transactions.symbol == sym] ending_amount = txn_sym.amount.sum() diff --git a/pyfolio/utils.py b/pyfolio/utils.py index 794542af..ba6a56d6 100644 --- a/pyfolio/utils.py +++ b/pyfolio/utils.py @@ -152,7 +152,7 @@ def extract_rets_pos_txn_from_zipline(backtest): backtest.index = backtest.index.tz_localize('UTC') returns = backtest.returns raw_positions = [] - for dt, pos_row in backtest.positions.iteritems(): + for dt, pos_row in backtest.positions.items(): df = pd.DataFrame(pos_row) df.index = [dt] * len(df) raw_positions.append(df)