Group Abstract Group Abstract

Message Boards Message Boards

data manipulation with Loop

GROUPS:

Hi, I have a table as result, but the first element the each "risult[[All,1]]" is two brackets empty. I would like delete it, with the command "drop" and a loop "for", or "do", because i have a lot of files.csv . But I can't. So, theses are my commands and files in attachment. I hope in your help!

SetDirectory[pathcast];
aa = FileNames["Cp*"];
risult = Table[Import[aa[[i]] ,"Table"],{i,1,2}]
For[i=1 ,i<3, i++, Drop[risult[[i,All]],1]]

Thanks

Margherita

POSTED BY: margherita ferrucci
Answer
4 months ago
SetDirectory[pathcast];
fileNames = FileNames["Cp*"];
result = Import[#, "Table"]& /@ fileNames;
resultDrop = Drop[#,1]& /@ result;

or

 SetDirectory[pathcast];
result = Drop[#, 1]& /@ (Import[#, "Table"]& /@ FileNames["Cp*"]);
POSTED BY: Ernst H.K. Stelzer
Answer
4 months ago

Thanks!

POSTED BY: margherita ferrucci
Answer
4 months ago