0
$\begingroup$

I read in my data using:

dat=Dataset[Import["dat.csv"]]

When I view the data it appears correct. However, when I execute a command like

dat[1, "Colname1"]

I receive the error:

Message: Part Colname 1 is not applicable to expressions of the form {_String, _, _String, \"country" | "NA" | "us", _, _, _String, _String, _, _String, _String, \_String, _String, _, _, 

Tag: Dataset

I'm not sure why this is happening, unfortunately I can't give a reproducible example with the data.

$\endgroup$
  • 1
    $\begingroup$ Dataset querying of that form requires you to convert the table imported by Import into a list of Associations. That's pretty easy to do with something like Map[Association@Thread[First[#]->Rest[#]]&, Import["dat.csv"]] $\endgroup$ – b3m2a1 Dec 3 '17 at 6:23
  • $\begingroup$ Thanks, I figured it out soon after asking. $\endgroup$ – nsh89 Dec 3 '17 at 6:37

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.