Skip to content

Deprecation warning for date_parser in Pandas read_csv function. #23

Description

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions