From 050dfd0b658905d61968eed7a55e576516d63ff8 Mon Sep 17 00:00:00 2001 From: James Zhang Date: Fri, 6 Dec 2024 03:44:39 -0500 Subject: [PATCH] Update core.py Fix the following bug in resample function: UnsupportedFunctionCall: numpy operations are not valid with resample. Use .resample(...).sum() instead --- quantstats/_plotting/core.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/quantstats/_plotting/core.py b/quantstats/_plotting/core.py index 8cf55c3..08157fd 100644 --- a/quantstats/_plotting/core.py +++ b/quantstats/_plotting/core.py @@ -291,10 +291,10 @@ def plot_timeseries( if resample: returns = returns.resample(resample) - returns = returns.last() if compound is True else returns.sum(axis=0) + returns = returns.last() if compound is True else returns.sum() if isinstance(benchmark, _pd.Series): benchmark = benchmark.resample(resample) - benchmark = benchmark.last() if compound is True else benchmark.sum(axis=0) + benchmark = benchmark.last() if compound is True else benchmark.sum() # --------------- fig, ax = _plt.subplots(figsize=figsize)