1
$\begingroup$

I have a really large file and would like to determine the pattern required for separating the columns by the different headers. I attempted to use Cases but it's been a long time since I've utilize the function Cases.

Mathematica seems to have a very poor source of information when it comes to data manipulation of imported CSV files.

raw_data = ReadList["file_name.csv", Word, RecordLists -> True]

enter image description here

The file can be uploaded from: https://ufile.io/mdvjz

Any help is appreciated.

$\endgroup$
1
$\begingroup$

It is not a .csv file but a semicolon separated values file, with missing values and even missing headers. So:

data = ReadList["...//rawdatatest.csv"
, Word, WordSeparators -> {";"}, RecordLists -> True, NullWords -> True
]


data[[;; 15, ;; 15]] // Dataset

enter image description here

$\endgroup$
  • $\begingroup$ Is there a good text for learning importing and "cleaning" of data? $\endgroup$ – Physkid Mar 2 '18 at 7:44
  • $\begingroup$ Maybe, but I'm not aware of any except sources here or in documentation of ReadList and friends. $\endgroup$ – Kuba Mar 2 '18 at 7:45
  • 1
    $\begingroup$ All those values are strings because it is not clear what to expect. So you need to use ToExpression if you want to do calculations. $\endgroup$ – Kuba Mar 2 '18 at 8:03
  • 1
    $\begingroup$ @Physkid it is for me but travel_time is not a valid variable name... $\endgroup$ – Kuba Mar 2 '18 at 8:11
  • 1
    $\begingroup$ @Physkid how about you start investigating the content by yourself: InputForm@data[[2 ;; 15, 15]] $\endgroup$ – Kuba Mar 2 '18 at 8:27

Your Answer

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

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