I want to import a csv to a dataset. This exact dataset successfully imported on a PC, but on a Mac one of the columns has garbage characters added to the key (see below example). I don't believe these characters are in the csv--regular "Import" doesn't show them. At least one other csv SemanticImport doesn't do this. If I rename the key, the characters remain. If I delete the leftmost column, the new key for the leftmost column gets these characters. So:

  1. What is causing this?
  2. Can I systematically avoid this issue? (I can probably think of a bandaid for this situation, but if this happens with any frequency this is a terrible roadblock to my workflow.)

enter image description here

  • $\begingroup$ Have you tried adding setting CharacterEncoding to something? Maybe it's to do with that. $\endgroup$ – Carl Lange Oct 16 '19 at 17:37
  • $\begingroup$ That looks like the UTF-8 BOM that is put at the beginning of an UTF-8 encoded file - not sure why SemanticImport fails to recognize that though. What Mathematica version are you using? $\endgroup$ – Lukas Lang Oct 16 '19 at 18:22
  • $\begingroup$ Ok, I've just checked it on MacOS with Mathematica 11.3 and I can reproduce the issue (not on Windows, same as OP) - you can fix it by adding CharacterEncoding -> "UTF8" as option to SemanticImport. Please also report this to Wolfram Support, since this is clearly a deficit of SemanticImport on MacOS $\endgroup$ – Lukas Lang Oct 16 '19 at 18:28
  • $\begingroup$ @LukasLang I am using Mathematica 12.0. Thanks for the bug fix in the mean time, works very well. $\endgroup$ – KBL Oct 16 '19 at 19:46

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.