Re: Import CSV can not understand string correctly
- To: mathgroup at smc.vnet.net
- Subject: [mg131731] Re: Import CSV can not understand string correctly
- From: Bill Rowe <readnews at sbcglobal.net>
- Date: Wed, 25 Sep 2013 02:36:05 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- Delivered-to: l-mathgroup@wolfram.com
- Delivered-to: mathgroup-outx@smc.vnet.net
- Delivered-to: mathgroup-newsendx@smc.vnet.net
On 9/24/13 at 4:16 AM, itais at wolfram.com (Itai Seggev) wrote: >On Sat, Sep 21, 2013 at 04:36:10AM -0400, Joug Raw wrote: >>In my CSV file, I have string fields like 3D22 or so. While I >>imported the CSV file in mathemtaica, the 3D22 string was converted >>to number 3x10^22. >>How dose this happened??? How can I avoid this kind of >>transformation and keep my original string when Import a CSV file? >You can set the option "Numeric"->False which will keep everything >as strings. Numbers will need to be explicitly converter to them, >though. Wouldn't this be equivalent to: StringSplit[ReadList[filename.csv, String],","] And given what Import needs to do to decide how to parse a file, wouldn't using StringSplit with ReadList be more efficient? Or perhaps the option "Numeric"->False effectively eliminates enough processing of the file by Import there is no significant difference?