janisdd / vscode-edit-csv

vs code extension to edit csv files with an excel like table ui
MIT License
227 stars 35 forks source link

About Column Display Error #82

Closed shio2345 closed 2 years ago

shio2345 commented 2 years ago

What OS?

Version?

1.64.2 (Universal)

Description

When a csv file with 2000rows × 300column is opened, 300 elements are combined into one column. The porpose is to get all elements contained in each column using py program.

janisdd commented 2 years ago

Can you maybe post a picture of this? I've tested with 2000x301 and it works as expected. csv_2000x301

shio2345 commented 2 years ago

As you can see in this picture, 1 column contain 300 elements. The original data had 200,000 rows, but it was divided and reduced to 2,000 rows. Could that be the cause of the error?

janisdd commented 2 years ago

Ah, I guess the delimiter was wrongly detected... Click on read options and check if it's the right delimiter (your data seems to use ,). You can hover over the ? next to the delimiter to check which one was detected.

shio2345 commented 2 years ago

I checked and it was labeled "Empty auto detect (detected :,)"

janisdd commented 2 years ago

This is strange... could you provide the csv file (or a smaller version) that reproduces this?

shio2345 commented 2 years ago

There may be a problem with the data, because it appears the same way when it opened in Excel.

janisdd commented 2 years ago

I see. It appears the problem are the "..." at the start and end of the lines. Quotes are normally used in csv to escape data, e.g., "cell 1, that has a comma", cell 2, cell 3. The editor thinks ever line is one big escaped cell.

Also I recommend installing the rainbow csv extension. It will color the columns in the text view of the csv file. For your file is only shows one color because the whole line is one big cell.

janisdd commented 2 years ago

If you generate the data yourself and you want to process the csv further, maybe consider using a csv library that handles all the special cases (escapes, multi line cells, ...)

shio2345 commented 2 years ago

Thanks to your answers, I was able to revise my improvements. I will now try to solve the problem in a different way. I appreciate your response