2
$\begingroup$

I would like to import a CSV without specifying the data type of each column before hand. SemanticImport almost does it, but doesn't appear to recognize numeric columns when there is a mixture of integers and reals. A simple example:

str = "0,0.4\n0,0.3\n0,0\n0.2,0.1";
ds = SemanticImportString[str, HeaderLines -> 0]
(* ds[-1,1] = Missing["Unrecognized",0.2] *)

Without specifying the type explicitly, how can I get a number rather than a missing value?

$\endgroup$
  • $\begingroup$ ImportString handles mixed data types as well: Map[Head, ImportString[str, "CSV"], {2}] $\endgroup$ – C. E. Mar 21 '15 at 11:24
  • $\begingroup$ I ran into this problem too. Unfortunately specifying data types makes import ridiculously slow. $\endgroup$ – Szabolcs May 20 '15 at 12:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.