I'm very much a newbie, so please forgive any errors or stupidity.

I have a csv file named csvfile. Its, contents confirmed by me, by looking at the contents in a text viewer are:


When I read this file into any other software -- say, R, Stata, or Excel, it results in four text items.

When I read it into Mathematica using

Import["csvfile", "CSV"]

I get a list that is a mix of strings and a number; after Flatten it becomes

{"234GJ", "9060G", 8096, "4162J"}

Can anyone tell my why this is happening?


Import["csvfile", "CSV", "Numeric" -> False] will stop it from interpreting elements as numbers, this can be found in CSV

| improve this answer | |
  • $\begingroup$ Thank you! I was searching on things such as "text to numbers" and "format" and not getting anywhere. Quick supplemental! Why does F at the end convert it to a number? $\endgroup$ – mjchalk Mar 1 '17 at 13:27
  • $\begingroup$ @mjchalk to be honest, I do not know what "F" means in this case, but at least it does not mean floating point number, because you can get integers from 123F and lower case "f" does nothing. The only documented formats are xxxD/dxxx and xxxE/exxx meaning exponential. $\endgroup$ – vapor Mar 1 '17 at 14:58
  • $\begingroup$ I have the answer! It is to be found in "CurrencyTokens". F is treated as a currency and by default is skipped on entry of a number (same for £, $ and even c apparently). So for data integrity purposes when importing using CSV it is best invoke "CurrencyTokens" -> None as an option. But thanks for your help on this. $\endgroup$ – mjchalk Mar 3 '17 at 14:33
  • $\begingroup$ @mjchalk thanks! It turns out that I missed the option part of the docs. $\endgroup$ – vapor Mar 3 '17 at 14:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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