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_csv and parameter date_format add example of a dict of columns #58462

Closed
1 task done
BdR76 opened this issue Apr 28, 2024 · 1 comment · Fixed by #58661
Closed
1 task done

DOC: read_csv and parameter date_format add example of a dict of columns #58462

BdR76 opened this issue Apr 28, 2024 · 1 comment · Fixed by #58661
Labels
Docs Needs Triage Issue that has not been reviewed by a pandas team member

Comments

@BdR76
Copy link

BdR76 commented Apr 28, 2024

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/pandas-docs/stable/reference/api/pandas.read_csv.html#:~:text=str%20or%20dict%20of%20column

Documentation problem

The read_csv has a parameter date_format which can can be "str or dict of columns" but it's not made clear dict of column.

When my csv file has 3 date columns and all are formatted as '%d-%m-%Y' then it's easy, I understand I can use date_format='%d-%m-%Y'. But when 2 columns are formatted as %d-%m-%Y and the last one is formatted %d-%m-%Y %H:%M:%S then not clear how the parametre should given?

Suggested fix for documentation

Can someone add a dict example to the documentation of the read_csv and the date_format parameter? I understand the documentation is generated from the sourcecode. But I couldn't find where the source code for read_csv is located on github

@BdR76 BdR76 added Docs Needs Triage Issue that has not been reviewed by a pandas team member labels Apr 28, 2024
@Aloqeely
Copy link
Contributor

Aloqeely commented Apr 28, 2024

In general, I agree that read_csv does not have any useful examples which I think we should improve, but I don't think we should add an example to demonstrate the use of every parameter.
For this specific case, I think it's better to improve the docstring of date_format, maybe it should say: 'dict of column names', or maybe in the description of the parameter we could mention that the dict will be in the form of: {column: format}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Docs Needs Triage Issue that has not been reviewed by a pandas team member
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants