Skip to content

DOC: Improve documentation for mode parameter in to_csv() method #47058

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

Closed
1 task done
kevinxperese opened this issue May 18, 2022 · 5 comments · Fixed by #47119
Closed
1 task done

DOC: Improve documentation for mode parameter in to_csv() method #47058

kevinxperese opened this issue May 18, 2022 · 5 comments · Fixed by #47119
Labels
Docs IO CSV read_csv, to_csv Needs Triage Issue that has not been reviewed by a pandas team member

Comments

@kevinxperese
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.DataFrame.to_csv.html

Documentation problem

The description for the mode parameter is too sparse. Additional information on other acceptable values would be helpful, especially mode='a'.

Suggested fix for documentation

Proposed change:
mode : str, default 'w'
String character(s) to indicate the mode in which the file is opened for writing. Valid values include: 'w' for "write" access, 'w+' or 'r+' for read and write access, 'x' or 'x+' for exclusive creation access, and 'a' or 'a+' for append access. All strings have an implied 't' for text access; binary access is not permitted.

@kevinxperese kevinxperese added Docs Needs Triage Issue that has not been reviewed by a pandas team member labels May 18, 2022
@kevinxperese kevinxperese changed the title DOC: DOC: Improve documentation for mode parameter in to_csv() method May 19, 2022
@MaruthiKo
Copy link
Contributor

Hi, I am new to Open source and I am looking forward to working on this issue, this would be my first open-source contribution.
Can you please tell me how I can help in this issue

@mroeschke mroeschke added the IO CSV read_csv, to_csv label May 25, 2022
@mroeschke
Copy link
Member

I think linking to Python's open docstring which describes the standard mode options that pandas dispatches to would be best: https://docs.python.org/3/library/functions.html#open

@MaruthiKo
Copy link
Contributor

I think linking to Python's open docstring which describes the standard mode options that pandas dispatches to would be best: https://docs.python.org/3/library/functions.html#open

I guess you are right will do that.

@kevinxperese
Copy link
Author

I think linking to Python's open docstring which describes the standard mode options that pandas dispatches to would be best: https://docs.python.org/3/library/functions.html#open

That crossed my mind, but I haven't seen such links in documentation elsewhere, so I wasn't sure if that would be a non-standard practice.

Also, adding just a link would not solve the problem of someone coming to the page looking for the appropriate parameter to use to append content to a file. (Searching the page for the word "append" will still turn up nothing; this is what I did when I was looking for the parameter to use.)

@MaruthiKo
Copy link
Contributor

I think linking to Python's open docstring which describes the standard mode options that pandas dispatches to would be best: https://docs.python.org/3/library/functions.html#open

That crossed my mind, but I haven't seen such links in documentation elsewhere, so I wasn't sure if that would be a non-standard practice.

Also, adding just a link would not solve the problem of someone coming to the page looking for the appropriate parameter to use to append content to a file. (Searching the page for the word "append" will still turn up nothing; this is what I did when I was looking for the parameter to use.)

If you don't mind me asking?
Are the changes that I made as per your suggestions good enough or should I change anything?

mroeschke added a commit that referenced this issue May 25, 2022
* Changes as requested in #47058

This is my first open-source contribution. Please let me know if there are any mistakes, will rectify them

* required changes as per #47058

Please let me know if have to change anything.

* changes to doc as per #47058

If any more changes required please let me know.

* Changes to doc as per #47058

Let me know if there are any changes

* Update pandas/core/generic.py

* Update pandas/core/generic.py

* Update pandas/core/generic.py

Co-authored-by: Matthew Roeschke <[email protected]>
yehoshuadimarsky pushed a commit to yehoshuadimarsky/pandas that referenced this issue Jul 13, 2022
* Changes as requested in pandas-dev#47058

This is my first open-source contribution. Please let me know if there are any mistakes, will rectify them

* required changes as per pandas-dev#47058

Please let me know if have to change anything.

* changes to doc as per pandas-dev#47058

If any more changes required please let me know.

* Changes to doc as per pandas-dev#47058

Let me know if there are any changes

* Update pandas/core/generic.py

* Update pandas/core/generic.py

* Update pandas/core/generic.py

Co-authored-by: Matthew Roeschke <[email protected]>
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 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.

3 participants