SemanticImportString
SemanticImportString["string"]
attempts to import a string semantically to give a Dataset object.
SemanticImportString["string",type]
attempts to interpret all elements in the string as being of the specified type.
SemanticImportString["string",{type1,type2,…}]
attempts to interpret elements in successive columns as being of the specified types.
SemanticImportString["string",col1->type1,col2->type2,…]
attempts to interpret elements in the named columns as being of the specified types.
SemanticImportString["string",typespec,form]
puts the result in the specified form.
Details and Options
- SemanticImportString has identical functionality to SemanticImport, except that it takes its input from a string rather than the contents of a file.
Examples
open allclose allBasic Examples (6)
Scope (4)
Import a string using the given delimiter:
Specify that the first line of the string to import is a header:
Specify that the first and third lines of the given string should be skipped:
Return missing values with the form "Unknown" in the special form Missing["UnknownData"]:
Options (12)
Delimiters (2)
HeaderLines (2)
MissingDataRules (4)
Applications (3)
Import a list of quantities as a Dataset object:
Import quantities as an array:
Apply any string transformations to the input file. In this case, the full text is simply set to uppercase:
Possible Issues (4)
The interpretation of data depends upon its context. Without further context, "12,3" is interpreted as a date:
In the context of the value "45,4", which is not a valid date, "12,3" is interpreted as two integers:
SemanticImportString, unlike SemanticInterpretation, does only simple, quick inferences. SemanticImportString imports state names as strings:
SemanticInterpretation imports state names as Entity objects:
Automatic type selection chooses from a smaller set of interpretations rather than specifying a type explicitly:
An Automatic type specifies an automatically selected number of columns:
An {Automatic} type specifies a single column of automatically selected type:
Automatic in a type list applies to the corresponding column sequentially:
Text
Wolfram Research (2014), SemanticImportString, Wolfram Language function, https://reference.wolfram.com/language/ref/SemanticImportString.html.
CMS
Wolfram Language. 2014. "SemanticImportString." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/SemanticImportString.html.
APA
Wolfram Language. (2014). SemanticImportString. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/SemanticImportString.html