# QuantBook Analysis Tool
# For more information see [https://www.quantconnect.com/docs/research/overview]
qb = QuantBook()
spy = qb.AddEquity("SPY")
#history = qb.History(qb.Securities.Keys, 360, Resolution.Daily)
# Create a 14 period RSI indicator
rsi = RelativeStrengthIndex(14)
df_rsi = qb.Indicator(rsi, spy.Symbol, 180, Resolution.Daily)
df_rsi.drop(['averageloss', 'averagegain'], axis=1, inplace=True).plot()
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-48-07024c2ec349> in <module>
10
11 df_rsi = qb.Indicator(rsi, spy.Symbol, 180, Resolution.Daily)
---> 12 df_rsi.drop(['averageloss', 'averagegain'], axis=1, inplace=True).plot()
13
14
AttributeError: 'NoneType' object has no attribute 'plot'
It works if I change inplace=False.
Why?
Where to find reference on setting inplace value in drop method?
Thanks
Louis Szeto
Hi Ruming
It is about the usage of pandas dataframe. .drop() will only be a void method without returning anything if inplace=True. It will be acting onthe original dataframe. You could do:
Please check in pandas documentation.
CheersLouis
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Ruming Jiang
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!