I have a huge CSV data, with the format like this:


I import the data with this code:

Import["data.csv", "Table", "FieldSeparators" -> ";"];

The problem is: Due to the empty string "" the table structure is broken: the cell is removed. To fix that, I need to manually edit the file. I replace the empty String "" with anything like "0":


Is there any option to deal with this? To consider "" as the real element?


1 Answer 1


Option "RepeatedSeparators" -> False solves the problem:

file = "\"5\";\"8\";\"2803\";

ImportString[file, "Table", "FieldSeparators" -> ";", "RepeatedSeparators" -> False]
{{5, 8, 2803, ""}, {"", 6, 2793, ""}}

Although I would consider the default behavior as a bug: the element "" (substring "\"\"" of the whole file) shouldn't be interpreted as an absence of a field, it is just an empty string "" which is a perfectly valid field!

  • $\begingroup$ Thank you Alexey! $\endgroup$
    – Nam Nguyen
    Feb 1, 2018 at 9:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.