Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

SemanticImport misinterprets rows with trailing blanks. Note the commas in the 2nd column:

SemanticImport["https://docs.google.com/spreadsheet/pub?key=0Ati-pfGwn22sdGt1T3E4S3NFYWxmQXY2ZUJ0MmhXd2c&output=csv", Delimiters -> ",", HeaderLines -> 1]

enter image description here

Import[...,Delimiters->","]//Dataset doesn't recognize the header line identifiers as keys.

(Note Google has deprecated csv web pub of gsheets)

share|improve this question

2 Answers 2

This is a good test set. I'm feeding this to the primary developer on SemanticImport, hopefully we can fix this for 10.0.1 (we've already improved SemanticImport a lot since the release branch).

share|improve this answer

This is one workaround:

csv = Import["https://docs.google.com/spreadsheet/pub?key=0Ati-pfGwn22sdGt1T3E4S3NFYWxmQXY2ZUJ0MmhXd2c&output=csv", "CSV"];

header = First[csv]

data = Rest[csv];

Dataset[
 AssociationThread[header -> #] & /@ data
]
share|improve this answer
    
That's the solution I've been using to build key-value structures before Dataset, except as a list of Rules, hence only Thread (Association@Thread = AssociationThread). But I meant a set of options for SemanticImport? –  alancalvitti Jul 10 at 20:22
    
@alancalvitti Sorry, I didn't re-read your question, and I remembered that you asked "Alternatively how to cast to Dataset from good ol' Import?" –  Szabolcs Jul 10 at 20:24
    
@alancalvitti Here's a solution that seems nicer than AssociationThread: community.wolfram.com/groups/-/m/t/290815?p_p_auth=u7fX6KQc (still not an answer to your SemanticImport question, just an improvement on this). –  Szabolcs Jul 10 at 20:39

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.