We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 596dd86 commit 8ed4186Copy full SHA for 8ed4186
pyfolio/timeseries.py
@@ -739,17 +739,11 @@ def perf_stats(returns, factor_returns=None):
739
740
"""
741
742
- stats = pd.Series()
743
-
744
- for stat_func in SIMPLE_STAT_FUNCS:
745
- stats[stat_func.__name__] = stat_func(returns)
746
747
- if factor_returns is not None:
748
- for stat_func in FACTOR_STAT_FUNCS:
749
- stats[stat_func.__name__] = stat_func(returns,
750
- factor_returns)
751
752
- return stats
+ return pd.Series(OrderedDict(
+ (stats_func.__name__, stats_func(returns)
+ for stats_func in SIMPLE_STATS_FUNCS +
+ (FACTOR_STAT_FUNCS if factor_returns else [])
+ ))
753
754
755
def get_max_drawdown_underwater(underwater):
0 commit comments