FutureWarning: Errors & Unsupported Function in Pandas
I'm getting the following errors
FutureWarning: Passing additional kwargs to DatetimeIndexResampler.sum has no impact on the result and is deprecated. This will raise a TypeError in a future version of pandas.
pandas.errors.UnsupportedFunctionCall: numpy operations are not valid with resample. Use .resample(...).sum() instead
When I try to run this code:
import quantstats as qs
qs.extend_pandas()
stock = qs.utils.download_returns('GLD')
qs.reports.html(stock, title='GLD Report', output='output/gld_report.html')
qs.reports.html(stock, "ASML", title='GLD vs ASML Report', output='output/asml_vs_gld.html')
Full Error String
same here
I got the same error, couldn't fina a solution...
same error for me,
What I have tried so far:
pip install quantstats --upgrade
returns = returns.resample(resample).last() if compound is True else returns.resample(resample).sum()
Modified core.py (line 294) as suggested
pip install numpy==1.24.4 pandas==1.3.5
Downgrade
Change this to https://github.com/ranaroussi/quantstats/blob/fc7b1bf3788ac64b0c58cc69fae435eddbd21b02/quantstats/_plotting/core.py#L292
if resample:
returns = returns.last() if compound is True else returns.resample(resample).sum(min_count=1)
if isinstance(benchmark, _pd.Series):
benchmark = benchmark.resample(resample)
benchmark = benchmark.last() if compound is True else benchmark.sum(axis=0)
Closing this issue as it's older than 2025 and has been addressed in the latest release 0.0.64. The pandas compatibility issues mentioned in this issue have been resolved with the comprehensive compatibility layer implemented in the latest version.