MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Export, Import, Convert Types Again?

  • To: mathgroup at
  • Subject: [mg57220] Re: Export, Import, Convert Types Again?
  • From: Gareth Russell <gjr2008 at>
  • Date: Sat, 21 May 2005 02:39:37 -0400 (EDT)
  • Organization: Columbia University
  • References: <d6k9ev$10q$>
  • Sender: owner-wri-mathgroup at


Usually it suffices to map ToExpression[] over the data you re-imported 
-- it should recognize the lists as lists, and so on.

What you are experiencing is not a bug -- you say yourself that you 
want to view the exported data in a text editor, so you export using a 
function which drops all the Mathematica 'baggage' such as heads.


On 2005-05-20 05:08:47 -0400, Lee Newman <leenewm at> said:

> 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

  • Prev by Date: Re: Export, Import, Convert Types Again?
  • Next by Date: Re: Re: Errors from FindFit
  • Previous by thread: Re: Export, Import, Convert Types Again?
  • Next by thread: Re: Export, Import, Convert Types Again?