Group Abstract Group Abstract

Message Boards Message Boards

ToExpression and decimal separators?

GROUPS:
i'm  a little confused a puzzled when it comes to the following : list  {{"1,78 ", 323}, {"1,78 ", 3371}, {"1,77 ", 20}, {"1,79 ",
  10}, {"1,77 ", 400}, {"1,78 ", 600}, {"1,77 ", 1140}, {"1,77 ",
  90}, {"1,77 ", 10}, {"1,75 ", 50}, {"1,77 ", 1900}, {"1,77 ",
  1490}, {"1,77 ", 10}, {"1,75 ", 3407}, {"1,74 ", 1500}, {"1,74 ",
  4500}, {"1,74 ", 323}, {"1,75 ", 3000}, {"1,75 ", 3623}, {"1,75 ",
  1377}, {"1,75 ", 1000}, {"1,75 ", 800},....}
 For example :Map[Head, Take[%, {15}], {2}] and its out :{{String, Integer}} . Why I can not convert string for real when using ToExpression ?
POSTED BY: Artur Kotarski
Answer
11 months ago
Are you looking for something like N[ToExpression["123"]]?
POSTED BY: Ilian Gachevski
Answer
11 months ago
pomitr2 = N[ToExpression[list[[All, {1}]]]] out ---ToExpression::sntx: Invalid syntax in or before "1,78 ". I want all fractions to be recognised as numbers for further
calculations .
                                                  
POSTED BY: Artur Kotarski
Answer
11 months ago
 Oh, I see, it is complaining about the decimal separator. Perhaps something like ToExpression[MapAt[StringReplace[#, "," -> "."] &, list, {All, 1}]] ?
POSTED BY: Ilian Gachevski
Answer
11 months ago
Thank You for steering me  towards right direction.
POSTED BY: Artur Kotarski
Answer
11 months ago