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

Replace all iteritems(deprecated) method to items method #715

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyfolio/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)) + '%'
Expand Down
2 changes: 1 addition & 1 deletion pyfolio/round_trips.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion pyfolio/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down