0
$\begingroup$

For some reason when importing some floating numbers, Mathematica does not interpret them correctly. For example this spreadsheet:

https://docs.google.com/spreadsheets/d/1zddNRubvfaRx1ySDXFbqGl5ohPdjI9Eld1Fr3ERWliA/edit?usp=sharing

And this code:

Import["https://docs.google.com/spreadsheets/d/\
1zddNRubvfaRx1ySDXFbqGl5ohPdjI9Eld1Fr3ERWliA/export?format=csv", \
"CSV", CharacterEncoding -> "UTF8"]
{{"2,15"}, {"2,45"}, {"1,88"}, {"2,35"}, {"11,35"}, {"2,08"}, {2272}, \
{"1,83"}, {"1,91"}, {"1,9"}}

See how 2,272 is incorrectly imported as 2272. Why is this the case, and how can I fix it?

$\endgroup$

1 Answer 1

3
$\begingroup$

You need to set the "NumberPoint" option explicitly if you're importing numbers with decimal commas:

ImportString["2,15
              2,45
              1,88
              2,35
              11,35
              2,08
              2,272
              1,83
              1,91
              1,9", "List", "NumberPoint" -> ","]
   {2.15, 2.45, 1.88, 2.35, 11.35, 2.08, 2.272, 1.83, 1.91, 1.9}
$\endgroup$

Your Answer

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

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