Skip to content

BUG: csv newline \n \r\n in Window with opened file #37757

@noklam

Description

@noklam

Note: Please read this guide detailing how to provide the necessary information for us to reproduce your bug.

Code Sample, a copy-pastable example

https://github.com/noklam/fsspec_pandas_bug_demo # if you need to download the data

# Your code here
import pandas as pd
import fsspec
from fsspec.implementations.local import LocalFileSystem
fs = LocalFileSystem()
df = pd.read_csv('iris.csv')

with fs.open('iris_fsspec.csv', 'w') as f:
    df.to_csv(f)

df.to_csv('iris_classic_pandas.csv')

Problem description

image
The output csv behavior is inconsistent

Expected Output

Expected to have identical output.

Output of pd.show_versions()

[paste the output of pd.show_versions() here leaving a blank line after the details tag]
OS: Window 10
INSTALLED VERSIONS

commit : 67a3d42
python : 3.8.2.final.0
python-bits : 64
OS : Windows
OS-release : 10
Version : 10.0.17763
machine : AMD64
processor : Intel64 Family 6 Model 85 Stepping 4, GenuineIntel
byteorder : little
LC_ALL : None
LANG : en_GB.UTF-8
LOCALE : English_Hong Kong SAR.1252

pandas : 1.1.4
numpy : 1.19.1
pytz : 2020.1
dateutil : 2.8.1
pip : 20.1
setuptools : 46.3.1.post20200515
Cython : None
pytest : None
hypothesis : None
sphinx : 3.2.1
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 2.10.3
IPython : 7.15.0
pandas_datareader: None
bs4 : None
bottleneck : None
fsspec : 0.6.3
fastparquet : None
gcsfs : None
matplotlib : 3.3.1
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : 0.17.1
pytables : None
pyxlsb : None
s3fs : None
scipy : None
sqlalchemy : 1.3.17
tables : None
tabulate : 0.8.7
xarray : None
xlrd : None
xlwt : None
numba : None

Metadata

Metadata

Assignees

No one assigned

    Labels

    IO CSVread_csv, to_csvIO DataIO issues that don't fit into a more specific labelUsage QuestionWindowsWindows OS

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions