Dennis
Dennis

Reputation: 1

pandas._config.config.OptionError: "No such keys(s): 'mode.use_inf_as_null'"

Any suggestion will be appreciated for the following question. I tried to use the code from the document in "lumibot" as i attached below. But there was a problem when i used the .backtest() function(Last part). The error shows that:

MyStrategy.backtest( pandas._config.config.OptionError: "No such keys(s): 'mode.use_inf_as_null'"

from datetime import datetime

from lumibot.backtesting import YahooDataBacktesting
from lumibot.strategies import Strategy


# A simple strategy that buys AAPL on the first day and hold it
class MyStrategy(Strategy):
    def on_trading_iteration(self):
        if self.first_iteration:
            aapl_price = self.get_last_price("AAPL")
            quantity = self.portfolio_value // aapl_price
            order = self.create_order("AAPL", quantity, "buy")
            self.submit_order(order)


# Pick the dates that you want to start and end your backtest
# and the allocated budget
backtesting_start = datetime(2020, 11, 1)
backtesting_end = datetime(2020, 12, 31)

# Run the backtest
MyStrategy.backtest(
    YahooDataBacktesting,
    backtesting_start,
    backtesting_end,
)

I tried to use different version of pandas but it didn't work.

The version of pandas i used is : 2.0.2

The intrepreter i used is : Python 3.9.7("base")/opt/anaconda3/bin/python

Upvotes: 0

Views: 823

Answers (1)

Tom Chen
Tom Chen

Reputation: 1

Try downgrading pandas to version 1.5.2.

Upvotes: 0

Related Questions