backtesting.py icon indicating copy to clipboard operation
backtesting.py copied to clipboard

FutureWarning in _plotting.py

Open kernc opened this issue 1 year ago • 2 comments

Discussed in https://github.com/kernc/backtesting.py/discussions/705

Originally posted by lxxseunghh July 31, 2022 Hi, I got hundreds of this same warning using backtest.plot method.

.../venv/lib/python3.8/site-packages/backtesting/_plotting.py:148: FutureWarning: Passing method to Int64Index.get_loc is deprecated and will raise in a future version. Use index.get_indexer([item], method=...) instead. new_bar_idx = new_index.get_loc(mean_time, method='nearest')

How can I remove this warning? Is there a way to remove it without modifying .../backtesting/_plotting.py file?

I'm currently using Python 3.8.9.

Thanks.

kernc avatar Jul 31 '22 11:07 kernc

Hi @kernc, Can I work on this?

kawishqayyum avatar Aug 23 '22 09:08 kawishqayyum

@kawishqayyum Absolutely, PR welcome!

kernc avatar Aug 24 '22 00:08 kernc