shinnytech / tqsdk-python

天勤量化开发包, 期货量化, 实时行情/历史数据/实盘交易
https://doc.shinnytech.com/tqsdk/latest
Apache License 2.0
3.57k stars 648 forks source link

Deprecation Warning for pd.DataFrame.append in tqsdk/tools/downloader.py Line 192 #487

Open ZhongHaoAustin opened 1 month ago

ZhongHaoAustin commented 1 month ago

Hello Team,

I've noticed that the pd.DataFrame.append method, which has been marked as deprecated, is still being used in the downloader.py script at line 192. To maintain best practices and ensure forward compatibility with future versions of Pandas, I recommend updating the code to use the recommended pd.concat method instead.

Here's the updated code snippet that replaces the deprecated append method with concat, which also handles the index resetting correctly:

df = pd.concat([df, pd.DataFrame({"datetime": [self._end_dt_nano + 1], "factor": [1.0]})], ignore_index=True)

This modification ensures that the DataFrame is updated properly without relying on deprecated features, and it maintains the DataFrame index continuity.

Thank you for considering this update. I believe it will help in keeping the codebase modern and efficient.