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

Fix UnsupportedFunctionCal #375

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

bbalouki
Copy link

ERROR:
qs.reports.full(returns, mode='full', benchmark=benchmark)
File "C:\ProgramData\miniconda3\envs\bbsdev\lib\site-packages\quantstats\reports.py", line 628, in full
plots(
File "C:\ProgramData\miniconda3\envs\bbsdev\lib\site-packages\quantstats\reports.py", line 1346, in plots
_plots.daily_returns(
File "C:\ProgramData\miniconda3\envs\bbsdev\lib\site-packages\quantstats_plotting\wrappers.py", line 512, in daily_returns
fig = _core.plot_timeseries(
File "C:\ProgramData\miniconda3\envs\bbsdev\lib\site-packages\quantstats_plotting\core.py", line 294, in plot_timeseries
returns = returns.last() if compound is True else returns.sum(axis=0)
File "C:\ProgramData\miniconda3\envs\bbsdev\lib\site-packages\pandas\core\resample.py", line 1183, in sum
nv.validate_resampler_func("sum", args, kwargs)
File "C:\ProgramData\miniconda3\envs\bbsdev\lib\site-packages\pandas\compat\numpy\function.py", line 376, in validate_resampler_func
raise UnsupportedFunctionCall(
pandas.errors.UnsupportedFunctionCall: numpy operations are not valid with resample. Use .resample(...).sum() instead

@JomaDeveloper
Copy link

ERROR: qs.reports.full(returns, mode='full', benchmark=benchmark) File "C:\ProgramData\miniconda3\envs\bbsdev\lib\site-packages\quantstats\reports.py", line 628, in full plots( File "C:\ProgramData\miniconda3\envs\bbsdev\lib\site-packages\quantstats\reports.py", line 1346, in plots _plots.daily_returns( File "C:\ProgramData\miniconda3\envs\bbsdev\lib\site-packages\quantstats_plotting\wrappers.py", line 512, in daily_returns fig = _core.plot_timeseries( File "C:\ProgramData\miniconda3\envs\bbsdev\lib\site-packages\quantstats_plotting\core.py", line 294, in plot_timeseries returns = returns.last() if compound is True else returns.sum(axis=0) File "C:\ProgramData\miniconda3\envs\bbsdev\lib\site-packages\pandas\core\resample.py", line 1183, in sum nv.validate_resampler_func("sum", args, kwargs) File "C:\ProgramData\miniconda3\envs\bbsdev\lib\site-packages\pandas\compat\numpy\function.py", line 376, in validate_resampler_func raise UnsupportedFunctionCall( pandas.errors.UnsupportedFunctionCall: numpy operations are not valid with resample. Use .resample(...).sum() instead

Thanks. It helped for me

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works for me.

finiya added a commit to finiya/quantstats that referenced this pull request Nov 21, 2024
1. Adopted ranaroussi#375 fixes on resample
2. modify df["col"].ffill(inplace=True) to df["col"] = df["col"].ffill()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants