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: file obj for to_csv must be newline='' #25624

Merged
merged 1 commit into from
Mar 11, 2019

Conversation

chris-b1
Copy link
Contributor

@jorisvandenbossche jorisvandenbossche added this to the 0.24.2 milestone Mar 10, 2019
Copy link
Member

@jorisvandenbossche jorisvandenbossche left a comment

Choose a reason for hiding this comment

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

Thanks!

@@ -1689,7 +1689,7 @@ The ``Series`` and ``DataFrame`` objects have an instance method ``to_csv`` whic
allows storing the contents of the object as a comma-separated-values file. The
function takes a number of arguments. Only the first is required.

* ``path_or_buf``: A string path to the file to write or a StringIO
* ``path_or_buf``: A string path to the file to write or a file object. If a file object it must be opened with `newline=''`
Copy link
Member

Choose a reason for hiding this comment

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

On all platforms, or only for Windows? (the issue seemed to be about windows, but didn't follow it)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So in practice, it only matters on Windows, but I think it's safe advice to give on all platforms. Python's csv docs do the same
https://docs.python.org/3/library/csv.html#csv.writer

@jreback jreback added IO CSV read_csv, to_csv Windows Windows OS labels Mar 10, 2019
@codecov
Copy link

codecov bot commented Mar 11, 2019

Codecov Report

Merging #25624 into master will decrease coverage by 3.22%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #25624      +/-   ##
==========================================
- Coverage   91.26%   88.03%   -3.23%     
==========================================
  Files         173      173              
  Lines       52968    56259    +3291     
==========================================
+ Hits        48339    49528    +1189     
- Misses       4629     6731    +2102
Flag Coverage Δ
#multiple 89.83% <ø> (ø) ⬆️
#single 41.9% <ø> (+0.18%) ⬆️
Impacted Files Coverage Δ
pandas/core/generic.py 76.65% <ø> (-17.01%) ⬇️
pandas/core/groupby/groupby.py 74.28% <0%> (-22.93%) ⬇️
pandas/plotting/_core.py 66.38% <0%> (-17.16%) ⬇️
pandas/core/arrays/sparse.py 76.66% <0%> (-15.52%) ⬇️
pandas/core/frame.py 81.68% <0%> (-15.12%) ⬇️
pandas/core/indexes/base.py 88.08% <0%> (-8.49%) ⬇️
pandas/core/base.py 90.96% <0%> (-6.81%) ⬇️
pandas/plotting/_misc.py 35.03% <0%> (-3.66%) ⬇️
pandas/core/config.py 84.45% <0%> (-2.6%) ⬇️
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e28ae70...9541062. Read the comment docs.

1 similar comment
@codecov
Copy link

codecov bot commented Mar 11, 2019

Codecov Report

Merging #25624 into master will decrease coverage by 3.22%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #25624      +/-   ##
==========================================
- Coverage   91.26%   88.03%   -3.23%     
==========================================
  Files         173      173              
  Lines       52968    56259    +3291     
==========================================
+ Hits        48339    49528    +1189     
- Misses       4629     6731    +2102
Flag Coverage Δ
#multiple 89.83% <ø> (ø) ⬆️
#single 41.9% <ø> (+0.18%) ⬆️
Impacted Files Coverage Δ
pandas/core/generic.py 76.65% <ø> (-17.01%) ⬇️
pandas/core/groupby/groupby.py 74.28% <0%> (-22.93%) ⬇️
pandas/plotting/_core.py 66.38% <0%> (-17.16%) ⬇️
pandas/core/arrays/sparse.py 76.66% <0%> (-15.52%) ⬇️
pandas/core/frame.py 81.68% <0%> (-15.12%) ⬇️
pandas/core/indexes/base.py 88.08% <0%> (-8.49%) ⬇️
pandas/core/base.py 90.96% <0%> (-6.81%) ⬇️
pandas/plotting/_misc.py 35.03% <0%> (-3.66%) ⬇️
pandas/core/config.py 84.45% <0%> (-2.6%) ⬇️
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e28ae70...9541062. Read the comment docs.

@TomAugspurger
Copy link
Contributor

Restarted to avoid the DST failures.

Just the sparse failure now, which is fixed on master. Should be OK to merge @jorisvandenbossche .

@jorisvandenbossche jorisvandenbossche merged commit c4fa3c9 into pandas-dev:master Mar 11, 2019
meeseeksmachine pushed a commit to meeseeksmachine/pandas that referenced this pull request Mar 11, 2019
thoo added a commit to thoo/pandas that referenced this pull request Mar 11, 2019
* upstream/master: (110 commits)
  DOC: hardcode contributors for 0.24.x releases (pandas-dev#25662)
  DOC: restore toctree maxdepth (pandas-dev#25134)
  BUG: Redefine IndexOpsMixin.size, fix pandas-dev#25580. (pandas-dev#25584)
  BUG: to_csv line endings with compression (pandas-dev#25625)
  DOC: file obj for to_csv must be newline='' (pandas-dev#25624)
  Suppress incorrect warning in nargsort for timezone-aware DatetimeIndex (pandas-dev#25629)
  TST: fix incorrect sparse test (now failing on scipy master) (pandas-dev#25653)
  CLN: Removed debugging code (pandas-dev#25647)
  DOC: require Return section only if return is not None nor commentary (pandas-dev#25008)
  DOC:Remove hard-coded examples from _flex_doc_SERIES (pandas-dev#24589) (pandas-dev#25524)
  TST: xref pandas-dev#25630 (pandas-dev#25643)
  BUG: Fix pandas-dev#25481 by fixing the error message in TypeError (pandas-dev#25540)
  Fixturize tests/frame/test_mutate_columns.py (pandas-dev#25642)
  Fixturize tests/frame/test_join.py (pandas-dev#25639)
  Fixturize tests/frame/test_combine_concat.py (pandas-dev#25634)
  Fixturize tests/frame/test_asof.py (pandas-dev#25628)
  BUG: Fix user-facing AssertionError with to_html (pandas-dev#25608) (pandas-dev#25620)
  DOC: resolve all GL03 docstring validation errors (pandas-dev#25525)
  TST: failing wheel building on PY2 and old numpy (pandas-dev#25631)
  DOC: Remove makePanel from docs (pandas-dev#25609) (pandas-dev#25612)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
IO CSV read_csv, to_csv Windows Windows OS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

line terminator issue (again) on windows when writing to_csv()
4 participants