Re: Export, Import, Convert Types Again?
- To: mathgroup at smc.vnet.net
- Subject: [mg57237] Re: [mg57193] Export, Import, Convert Types Again?
- From: "Tomas Garza Hernandez" <tgarza10 at msn.com>
- Date: Sat, 21 May 2005 02:40:45 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
If you are using your imported data only within Mathematica (except, of course, when you are through with the problem), then use ">>" (called "Put") to save in internal format, and "<<" (or "Get") to retrieve into your notebook. This will preserve your data exactly as used in the notebook. Tomas Garza Mexico City >From: Lee Newman <leenewm at umich.edu> To: mathgroup at smc.vnet.net >Subject: [mg57237] [mg57193] Export, Import, Convert Types Again? >Date: Fri, 20 May 2005 04:43:32 -0400 (EDT) > >Q: What is the (best) way to save a big expression of data to be used >later in the same notebook without having to do type conversion processing? > >Situation: > >1) I have a notebook that imports data from various Excel spreadsheets >and converts the data to the desired types. When complete, I "save" the >expression containing the data using Export, i.e, >Export["featureDB.tsv", "TSV"]. I do this so I don't have to re-process >the data everytime I do analysis on it in this notebook. > >2) When I open the noteobook again, I import the data using the >statement: featureDB = Import["featureDB.tsv"] > >Problem: >Many of type conversions that I took the time to process are lost. >Using Head /@ featureDB[[1]] before and after the export/re-import, the >types are as follows: > >Before: {Integer, Integer, List, List, List, Integer, List, List, >Symbol, List} >After : {Integer, Integer, String, String, String, Integer, String, >String, String, String} > >So it seems that lists become Strings as Symbols (e.g. True, False, >Null). I use Export so I can view the data outside Mathematica using a >text >editor -- should I use Save instead? Is there another Export format >that will preserve mathematica expressions like lists upon Import? > >Thanks, >Lee > > > >