SimFin / simfin

Simple financial data for Python
https://simfin.com/
Other
299 stars 39 forks source link

Deprecation warning for `date_parser` in Pandas `read_csv` function. #23

Open ghost opened 1 year ago

ghost commented 1 year ago

I currently encounter a deprecation warning when using the pd.read_csv function with date_parser.

FutureWarning: The argument 'date_parser' is deprecated and will be removed in a future version. Please use 'date_format' instead, or read your data in as 'object' dtype and then call 'to_datetime'.

this is supported by the Pandas documentation, which states:

Deprecated since version 2.0.0: Use date_format instead, or read in as object and then apply to_datetime() as-needed.

this warning was obtained whilst running the following line of code:

https://github.com/SimFin/simfin/blob/413ec1691b78da96ef834890a0aa543c3694d6d8/simfin/load.py#L154-L155

as per the warning and the supporting Pandas documentation, I'm recommending that we read data in as object dtype and then call pd.to_datetime() to convert each of these columns from object dtype to datetime64[ns] dtype.

I've submitted a pull request here.

ty