I have many csv files in one folder and I have to import all of them into Mathematica. I need actually just two columns and all the rows except for the first one so I got rid of another 6 columns and the first row using Cases and Rest commands. It actually works pretty well (only date format is wrong because my csv is in european date format day.month.year hour:minute and Mathematica says it is ambigious and writes in american format, see pic) but only when I import one csv. If I try to import more it doesn´t work. Could anyone please help me to import all csvs from the folder and tell me how to tell Mathematica to write it in european date format?
My code for multiple csvs:
allfiles =
FileNames[All,
"N:\\ DataCacheScada \\ IIS \\ vocko01 \\ Distribucni_kabely \\"];
cableD = Cases[
Rest[Import[#, "Table", "FieldSeparators" -> ";"] & /@
allfiles], {x1_, x2_, x3_, x4_, x5_, x6_,
x7_}] /. {{x1_, x2_, x3_, x4_, x5_, x6_, x7_} -> {DateObject[x6],
x7}}
You can download two of my csvs here: https://gofile.io/?c=rxLrwn
Thank you for your advices!
{DateObject@StringReplace[#1,x : DigitCharacter .. ~~ "." ~~ y : DigitCharacter .. ~~ "." ~~ z : DigitCharacter .. ~~ " " ~~ rest__ :> z <> "/" <> y <> "/" <> x <> " " <> rest],#2}&@@@Import["file.csv","Table","FieldSeparators"->";"][[2;;,{-2,-1}]]
. This is for one file, no errors. Then you can map to all files. $\endgroup$@@@Import["file.csv","Table","FieldSeparators"->";"][[2;;,{-2,-1}]]
to@@@#&/@(Import[#,"Table","FieldSeparators"->";"][[2;;,{-2,-1}]]&/@allfiles)
$\endgroup$