I insert the data into the service csvlint.io because I get the error 22 Problem encountered on line 2
in Weka in trying to import CSV file the following way.
`java -jar weka.jar` > Explorer >
Preprocess > Open file > [select file format CSV]
> [Choose CSV file]
Similar error message is in the thread Not recognised as an csv file in Weka which I have before solved by inserting the data into LibreOffice, autofixing there and saving as CSV but I would like to find a commandline solution there. I get the following warning in the csvlint.io service from there although I have generated Data in Debian 9.
Structural problem: Non-standard Line Breaks on row 1
Your CSV appears to use LF line-breaks. While this will be fine in most cases, RFC 4180 specifies that CSV files should use CR-LF (a carriage-return and line-feed pair, e.g. \r\n). This may be labelled as "Windows line endings" on some systems.
Data
Ni, Aika, Aika_l, Un, Unen, Unen_kesto, Uniluokat_R, Uniluokat_k, Uniluokat_s, HRV_RMSSD_a, HRV_RMSSD_i, Kokonaisp, Palautumisen_k, Hermoston_t, Syke_ave_m, Syke_a, Syke_l, Hengitystiheys_ave_m, Hengitystiheys_a, Hengitystiheys_min_a, Liikeaktiivisuus_l, Liikeaktiivisuus_a, Paivamaara_l
"Masi", 23072010-2200+0300, 24072010-0600+0300, 70, 7h40, 6h30, 1h40, 3h40, 1h10, 67.0, 43.0, 24.0, 430, 30, 70, 50, 40, 20, 10, 10, 150, 260, 24.10.2010
"Masi", 23072010-2200+0300, 24072010-0600+0300, 70, 7h40, 6h30, 1h40, 3h40, 1h10, 67.0, 43.0, 24.0, 430, 30, 70, 50, 40, 20, 10, 10, 150, 260, 24.10.2010
To remove horizontal white space there, you can run tr -d "[:blank:]"
on the data but it should not necessary.
I think line-endings are not an issue here because fixing the file with dos2unix
or unix2dos
(meuh) does not solve the issue.
OS: Debian 9
unix2dos
from packagedos2unix
.dos2unix
orunix2dos
, then it strongly suggests that line-endings are not the issue.csv2rec
andrec2csv
tools). BTW is the third fieldAika_l Un
supposed to be a date with a space and a number (24072010-0600+0300 70
) - that would make it a string, not a date field.awk -F', ' -v OFS=, '{gsub(" ",",",$3)}; NR==1 {$1=$1;print}; NR > 1 {split($22,a,"."); $22 = a[3]"-"a[2]"-"a[1]; print }' data.csv
. That replaces the space in field 3 with a , (i.e. turning it into two fields, Aika_l and Un), and changes the date in field 22 from DD.MM.YYYY to YYYY-MM-DD. I'm guessing that this might stop csvlint.io from complaining about your csv file.