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

DOC: read_excel and read_csv have a new date_format parameter, but the format of this is not documented #54285

Closed
1 task done
johnmreynolds opened this issue Jul 28, 2023 · 7 comments · Fixed by #54705
Closed
1 task done
Assignees
Labels
Docs IO CSV read_csv, to_csv IO Excel read_excel, to_excel

Comments

@johnmreynolds
Copy link

Pandas version checks

  • I have checked that the issue still exists on the latest versions of the docs on main here

Location of the documentation

https://pandas.pydata.org/docs/dev/reference/api/pandas.read_csv.html
https://pandas.pydata.org/docs/dev/reference/api/pandas.read_excel.html

Documentation problem

In pandas 2.0 various data read functions have a new date_format parameter.

However, the documentation doesn't actually say what the format of this is.

I'm assuming it's supposed to be a strftime format, but it doesn't say.

(And separately, my testing suggests it doesn't work - but that's probably due to #44284 )

Suggested fix for documentation

Specify in the documentation what the format of the date_format parameter is.

@johnmreynolds johnmreynolds added Docs Needs Triage Issue that has not been reviewed by a pandas team member labels Jul 28, 2023
@asishm-wk
Copy link

Thanks for the report.
The linked issue is unrelated - that is for writing excel files only.

And separately, my testing suggests it doesn't work

Can you provide a reproducible example?

@johnmreynolds
Copy link
Author

Ah, so it turns out that my issue with the functionality was that parse_dates=True doesn't do what I expected. The behavior does match the documentation, it was just a bit of a surprise. Passing the name(s) of the date columns into parse_dates does seem to work.

@johnmreynolds
Copy link
Author

And indeed, the format of date_format does seem to be strftime, so the original issue can be summarized as "date_format parameter documentation should say that it uses strftime format"

@johnmreynolds
Copy link
Author

It also seems to support "ISO8601" and "mixed" like to_datetime. So it could possibly just reference the format in that. It does already link to to_datetime, but in the context of an alternative to use.

@lithomas1 lithomas1 removed the Needs Triage Issue that has not been reviewed by a pandas team member label Aug 3, 2023
@lithomas1
Copy link
Member

Thanks for reporting this issue.

I had a look, and I think you're right about it being a strftime format (I think it should be the same as foramt in to_datetime but I don't use the date stuff in pandas a lot).

Would you like to raise a pull request to document this?

@lithomas1 lithomas1 added IO CSV read_csv, to_csv IO Excel read_excel, to_excel labels Aug 3, 2023
@rsm-23
Copy link
Contributor

rsm-23 commented Aug 23, 2023

take

@brendan-m-murphy
Copy link

Any chance this could be sign-posted in the current 2.12 docs?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Docs IO CSV read_csv, to_csv IO Excel read_excel, to_excel
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants