Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecation warning for date_parser in Pandas read_csv function. #23

Open
ghost opened this issue Sep 23, 2023 · 0 comments
Open

Deprecation warning for date_parser in Pandas read_csv function. #23

ghost opened this issue Sep 23, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@ghost
Copy link

ghost commented Sep 23, 2023

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:

simfin/simfin/load.py

Lines 154 to 155 in 413ec16

df = pd.read_csv(path, sep=';', header=0,
parse_dates=parse_dates, date_parser=date_parser)

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

@ghost ghost added the bug Something isn't working label Sep 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

0 participants