quantstats icon indicating copy to clipboard operation
quantstats copied to clipboard

Error with Report.full output

Open ariesvtb opened this issue 4 years ago • 6 comments

TypeError Traceback (most recent call last) in () 6 7 # (benchmark can be a pandas Series or ticker) ----> 8 qs.reports.full(stock_RoR)

3 frames /usr/local/lib/python3.6/dist-packages/quantstats/reports.py in full(returns, benchmark, rf, grayscale, figsize, display, compounded) 248 249 plots(returns=returns, benchmark=benchmark, --> 250 grayscale=grayscale, figsize=figsize, mode='full') 251 252

/usr/local/lib/python3.6/dist-packages/quantstats/reports.py in plots(returns, benchmark, grayscale, figsize, mode, compounded, rolling_period) 518 grayscale=grayscale, 519 figsize=(figsize[0], figsize[0]*.5), --> 520 show=True, ylabel=False) 521 522 _plots.histogram(returns, grayscale=grayscale,

/usr/local/lib/python3.6/dist-packages/quantstats/_plotting/wrappers.py in yearly_returns(returns, benchmark, fontname, grayscale, hlw, hlcolor, hllabel, match_volatility, log_scale, figsize, ylabel, subtitle, compounded, savefig, show) 379 ylabel=ylabel, 380 subtitle=subtitle, --> 381 savefig=savefig, show=show) 382 if not show: 383 return fig

/usr/local/lib/python3.6/dist-packages/quantstats/_plotting/core.py in plot_returns_bars(returns, benchmark, returns_label, hline, hlw, hlcolor, hllabel, resample, title, match_volatility, log_scale, figsize, grayscale, fontname, ylabel, subtitle, savefig, show) 109 if subtitle: 110 ax.set_title("\n%s - %s " % ( --> 111 df.index.date[:1][0].strftime('%Y'), 112 df.index.date[-1:][0].strftime('%Y') 113 ), fontsize=12, color='gray')

TypeError: 'method' object is not subscriptable

ariesvtb avatar Jan 10 '21 03:01 ariesvtb

I have the same issue. the Html report as well is broken. Is there any intermediary solution? Thanks.

AE

AnasEssahal avatar Feb 04 '21 05:02 AnasEssahal

At my place I can approve it. Even with:

%matplotlib inline
import quantstats as qs

stock = qs.utils.download_returns('FB')
qs.reports.full(stock)

I am getting:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
/workspaces/DeepRLValueTrading/backtesting/visualize.py in 
      54 stock = qs.utils.download_returns('FB')
----> 55 qs.reports.full(stock)

/usr/local/lib/python3.6/site-packages/quantstats/reports.py in full(returns, benchmark, rf, grayscale, figsize, display, compounded)
    248 
    249     plots(returns=returns, benchmark=benchmark,
--> 250           grayscale=grayscale, figsize=figsize, mode='full')
    251 
    252 

/usr/local/lib/python3.6/site-packages/quantstats/reports.py in plots(returns, benchmark, grayscale, figsize, mode, compounded, rolling_period)
    518                           grayscale=grayscale,
    519                           figsize=(figsize[0], figsize[0]*.5),
--> 520                           show=True, ylabel=False)
    521 
    522     _plots.histogram(returns, grayscale=grayscale,

/usr/local/lib/python3.6/site-packages/quantstats/_plotting/wrappers.py in yearly_returns(returns, benchmark, fontname, grayscale, hlw, hlcolor, hllabel, match_volatility, log_scale, figsize, ylabel, subtitle, compounded, savefig, show)
    379                                   ylabel=ylabel,
    380                                   subtitle=subtitle,
--> 381                                   savefig=savefig, show=show)
    382     if not show:
    383         return fig

/usr/local/lib/python3.6/site-packages/quantstats/_plotting/core.py in plot_returns_bars(returns, benchmark, returns_label, hline, hlw, hlcolor, hllabel, resample, title, match_volatility, log_scale, figsize, grayscale, fontname, ylabel, subtitle, savefig, show)
    109     if subtitle:
    110         ax.set_title("\n%s - %s                   " % (
--> 111             df.index.date[:1][0].strftime('%Y'),
    112             df.index.date[-1:][0].strftime('%Y')
    113         ), fontsize=12, color='gray')

TypeError: 'method' object is not subscriptable

So it does not depend on our dataframes.

For debugging here are the verions of my installed packages.

python: 3.6.13 quantstats 0.0.26

QS dependencies seaborn 0.11.0 yfinance 0.1.55 matplotlib 3.3.3 tabulate 0.8.7 scipy 1.5.4 pandas 1.1.4 numpy 1.19.4

Hoping that this could help :-)

Pit-Storm avatar Mar 09 '21 17:03 Pit-Storm

Same issue. Anyone find a workaround?

pchaganti avatar Mar 21 '21 17:03 pchaganti

Same here

msaracer avatar Apr 03 '21 12:04 msaracer

I have the exact same issue as well

lbonherbe avatar May 11 '21 09:05 lbonherbe

tried downgrading, still the same issue

image

shantanu-collab avatar Jun 18 '21 18:06 shantanu-collab