Closed Caceresenzo closed 2 years ago
Anyone else solve this for version 0.0.57? I am just using 2022 data and throwing error
ValueError: cannot convert float NaN to integer
@Dynamic50, a temporary fix can be changing the library source code:
by adding a single line:
), fontsize=12, color='gray')
beta = _stats.rolling_greeks(returns, benchmark, window1)['beta']
beta.fillna(0, inplace=True) # <-- this line
ax.plot(beta, lw=lw, label=window1_label, color=colors[1])
if window2:
@ranaroussi I can do a pull request if that okay with you.
ValueError: Must specify a fill 'value' or 'method'.
Hmm... troubleshooting now
Oops, you are right. I will edit my comment.
IndexError: index 0 is out of bounds for axis 0 with size 0
Is your dataframe empty?
Seem like another issue. Sorry I cannot help your further with that :/
No, its not... very strange.
I use a longer set of data from the database and reads fine....
core.py
beta = _stats.rolling_greeks(returns, benchmark, window1)['beta']
beta.fillna(0, inplace=True)
ax.plot(beta, lw=lw, label=window1_label, color=colors[1])
stats.py
*can adjust time period in line 227
Thanks
The 6 months rolling do not work when there is not enough data.
Here is the stack trace it generate:
A simple fix can be to do
fillna()
on the beta after this line: https://github.com/ranaroussi/quantstats/blob/bfc247071fa1b80772cb101f2b31b72b8227cabf/quantstats/_plotting/core.py#L506I can do a pull request if you want. Please tell me if you found anything that would make this fix incorrect.