-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
ENH: Support for list of formats in pd.to_datetime() #55226
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
Labels
Datetime
Datetime data dtype
Enhancement
Needs Discussion
Requires discussion from core team before further action
Comments
thanks for the suggestion - yeah I've had something like this in the back of my mind, might be a good one |
gusthavoMFS
added a commit
to gusthavoMFS/pandas
that referenced
this issue
Oct 26, 2023
gusthavoMFS
added a commit
to gusthavoMFS/pandas
that referenced
this issue
Oct 26, 2023
gusthavoMFS
added a commit
to gusthavoMFS/pandas
that referenced
this issue
Oct 26, 2023
gusthavoMFS
added a commit
to gusthavoMFS/pandas
that referenced
this issue
Oct 26, 2023
gusthavoMFS
added a commit
to gusthavoMFS/pandas
that referenced
this issue
Oct 26, 2023
gusthavoMFS
added a commit
to gusthavoMFS/pandas
that referenced
this issue
Oct 26, 2023
take |
gusthavoMFS
added a commit
to gusthavoMFS/pandas
that referenced
this issue
Nov 21, 2023
gusthavoMFS
added a commit
to gusthavoMFS/pandas
that referenced
this issue
Nov 21, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Datetime
Datetime data dtype
Enhancement
Needs Discussion
Requires discussion from core team before further action
Feature Type
Adding new functionality to pandas
Changing existing functionality in pandas
Removing existing functionality in pandas
Problem Description
Frequently,
pd.to_datetime()
needs to be used to convert dates of mixed formats. Currently, it supports the format'mixed'
, but as the documentation says, it is risky:Wouldn't it be good if this mixed format interpretation could be done without being "risky"?
Feature Description
This mixed format interpretation could be done without ambiguity by letting
format
accept also lists of multiple formats, e.g.["%Y-%m-%d", "%Y-%m-%d %H:%M:%S"]
. Then the function would first convert all entries that can be converted using the first rule, and then proceed with trying to convert the remaining unparsed entries using the next rules in the list.Example usage:
Alternative Solutions
This example illustrates quite well how this could be implemented:
Additional Context
No response
The text was updated successfully, but these errors were encountered: