MathGroup Archive 2010

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

Search the Archive

Re: Convert string list to number list

  • To: mathgroup at smc.vnet.net
  • Subject: [mg106659] Re: Convert string list to number list
  • From: Bill Rowe <readnews at sbcglobal.net>
  • Date: Wed, 20 Jan 2010 06:49:38 -0500 (EST)

On 1/19/10 at 5:13 AM, canopus56 at yahoo.com (Canopus56) wrote:

>Thanks to all who replied.  Even with ToExpression, I was trouble
>getting the string to numeric conversion to persistently take when
>replacing to a list. There was some weird runtime error where you
>could run and get:

>lstTriple =lstTriple/.{x_,y_,z_}->{x,ToExpression[y],z}

>lstTriple;

>NumericQ[listTriple[[3,2]]] True

>lstTriple;

>NumericQ[listTriple[[3,2]]] False

Since there is no object in Mathematica that can be used as an
argument for NumbericQ that will return True and False, you must
have done something you are not showing above that would explain
the result.

>After splitting out the column containing numeric string data
>explicitly to a new single variable list, then running the Map
>function using ToExpression, and then reassembling the list triple,
>would Mathematica recognize the numeric and not string format
>persistently.

After reading this several times, I cannot determine whether you
still have a problem or exactly what you are saying Mathematica
is doing. I will note since

In[6]:= Attributes[ToExpression]

Out[6]= {Listable,Protected}

it is not necessary to use Map in order to covert each string in
a list of strings to a number using ToExpression.



  • Prev by Date: Re: Re: Testing Mathematica Expressions?
  • Next by Date: exporting numerical data
  • Previous by thread: Re: Convert string list to number list
  • Next by thread: Re: Re: Convert string list to number list