Skip to content

BUG: add date_format to read_csv / Date parsing mistake. read_csv #50320

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

Merged
merged 3 commits into from
Dec 27, 2022

Conversation

MarcoGorelli
Copy link
Member

@MarcoGorelli MarcoGorelli commented Dec 17, 2022

#50319 will happen to close #2586

This PR will make sure that bugs like #2586 don't appear again

Closes #2586

@MarcoGorelli MarcoGorelli added Bug Datetime Datetime data dtype labels Dec 17, 2022
@MarcoGorelli MarcoGorelli marked this pull request as draft December 17, 2022 19:31
@MarcoGorelli MarcoGorelli marked this pull request as ready for review December 17, 2022 22:06
@MarcoGorelli MarcoGorelli marked this pull request as draft December 17, 2022 22:06
MarcoGorelli added 2 commits December 22, 2022 21:17
@MarcoGorelli MarcoGorelli marked this pull request as ready for review December 22, 2022 21:22
Copy link
Member

@mroeschke mroeschke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks okay. Needs a whatsnew note?

@MarcoGorelli
Copy link
Member Author

I don't think so, I don't have any example of where this makes a difference to users

Basically, PDEP4 was supposed to fix #2586, but didn't because of an exception which was being swallowed by this try-except block
The raising of that exception was fixed in #50319
and now this except block doesn't make a difference (all tests pass without it).

Given that PDEP4 hasn't had an effect on users yet, I'd consider this just be part of that change and not have a separate whatsnew

@mroeschke mroeschke added this to the 2.0 milestone Dec 27, 2022
@mroeschke mroeschke merged commit 3bc2203 into pandas-dev:main Dec 27, 2022
@mroeschke
Copy link
Member

Thanks @MarcoGorelli

@jorisvandenbossche
Copy link
Member

With the removal of the dateutil code path, the docstring of date_parser is outdated?

date_parser : function, optional
    Function to use for converting a sequence of string columns to an array of
    datetime instances. The default uses ``dateutil.parser.parser`` to do the
    conversion. Pandas will try to call `date_parser` in three different ways,
    advancing to the next if an exception occurs: 1) Pass one or more arrays
    (as defined by `parse_dates`) as arguments; 2) concatenate (row-wise) the
    string values from the columns defined by `parse_dates` into a single array
    and pass that; and 3) call `date_parser` once for each row using one or
    more strings (corresponding to the columns defined by `parse_dates`) as
    arguments.

Although I suppose it was already outdated, because dateutil.parser was already a fallback after to_datetime?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Datetime Datetime data dtype
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: add date_format to read_csv / Date parsing mistake. read_csv
4 participants