jupyterlab-spreadsheet-editor icon indicating copy to clipboard operation
jupyterlab-spreadsheet-editor copied to clipboard

Extra row added when saving a csv

Open marberts opened this issue 2 years ago • 0 comments
trafficstars

Description

Saving a csv prepared with R or pandas adds an extra row at the bottom. That is, a csv like

a,b
1,3
2,4

becomes

a,b
1,3
2,4
,    <-- added

Reproduce

Make a csv with R (or pandas).

Rscript -e "write.csv(data.frame(a = 1:2, b = 3:4), row.names = FALSE, eol = '\r\n')" > test.csv

Then open test.csv in JupyterLab, modify the content of a cell, and save.

Removing the line ending on the last line before opening in JupyterLab seems to fix it, but having a CRLF at the end of the last row is allowed by RFC 4180. That is,

cat -e test.csv

a,b^M$
1,3^M$
2,4^M$

results in an extra line, whereas

cat -e test.csv

a,b^M$
1,3^M$
2,4

works as expected.

Expected behavior

I expect no extra row added when saving a csv.

Context

  • Python package version: 0.6.1
  • Extension version: 0.6.1
  • Operating System and its version: Ubuntu 20.04
  • Browser and its version: Firefox 109.0.1

marberts avatar Feb 18 '23 04:02 marberts