sabirjana / blog

Code and data for my blogs
92 stars 79 forks source link

error with pyfolio; AttributeError: 'Series' object has no attribute 'iteritems' #3

Open jaoujal opened 11 months ago

jaoujal commented 11 months ago

hi, thank you for tis great work,

I got this error with pyfolio:


AttributeError Traceback (most recent call last) ~\AppData\Local\Temp\ipykernel_21596\3278245655.py in ?() 1 # get performance statistics for strategy ----> 2 pf.show_perf_stats(returns)

~\anaconda3\envs\FX\Lib\site-packages\pyfolio\plotting.py in ?(returns, factor_returns, positions, transactions, turnover_denom, live_start_date, bootstrap, header_rows) 644 APPROX_BDAYS_PER_MONTH) 645 perf_stats = pd.DataFrame(perf_stats_all, columns=['Backtest']) 646 647 for column in perf_stats.columns: --> 648 for stat, value in perf_stats[column].iteritems(): 649 if stat in STAT_FUNCS_PCT: 650 perf_stats.loc[stat, column] = str(np.round(value * 100, 651 1)) + '%'

~\anaconda3\envs\FX\Lib\site-packages\pandas\core\generic.py in ?(self, name) 6200 and name not in self._accessors 6201 and self._info_axis._can_hold_identifiers_and_holds_name(name) 6202 ): 6203 return self[name] -> 6204 return object.getattribute(self, name)

AttributeError: 'Series' object has no attribute 'iteritems'