2016 Update
This commit is contained in:
parent
948b86eafa
commit
dcf5d15da3
7965 changed files with 139854 additions and 31002 deletions
|
|
@ -0,0 +1,18 @@
|
|||
\\ CSV data manipulation
|
||||
\\ 10/24/16 aev
|
||||
\\ processCsv(fn): Where fn is an input path and file name (but no actual extension).
|
||||
processCsv(fn)=
|
||||
{my(F, ifn=Str(fn,".csv"), ofn=Str(fn,"r.csv"), cn=",SUM",nf,nc,Vr,svr);
|
||||
if(fn=="", return(-1));
|
||||
F=readstr(ifn); nf=#F;
|
||||
F[1] = Str(F[1],cn);
|
||||
for(i=2, nf,
|
||||
Vr=stok(F[i],","); if(i==2,nc=#Vr);
|
||||
svr=sum(k=1,nc,eval(Vr[k]));
|
||||
F[i] = Str(F[i],",",svr);
|
||||
);\\fend i
|
||||
for(j=1, nf, write(ofn,F[j]))
|
||||
}
|
||||
|
||||
\\ Testing:
|
||||
processCsv("c:\\pariData\\test");
|
||||
Loading…
Add table
Add a link
Reference in a new issue