3 registered members (VoroneTZ, monk12, Quad),
829
guests, and 4
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
bug in parseData?
#480193
05/25/20 18:49
05/25/20 18:49
|
Joined: May 2015
Posts: 390 Czech Republic
Grat
OP
Senior Member
|
OP
Senior Member
Joined: May 2015
Posts: 390
Czech Republic
|
HI, I trying this code:
int loadPredict(const string idx, const string TF, const int nHandle){
string InName = strf("Predikce\\%s_%s_%s.csv",strx(Asset,"/",""),idx,TF); // name of a single year CSV file
string Format = "+%t,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,i,f";
int Records = dataParse(nHandle,Format,InName);
int i,j;
for (j=0;j<Records;j++)
{
print(TO_LOG,"\n %d",dataInt(nHandle,j,0));
for (i=0;i<20;i++)
print(TO_LOG," %f",dataVar(nHandle,j,i));
print(TO_LOG," %d",dataInt(nHandle,j,ERR_WIN));
print(TO_LOG," %f",dataVar(nHandle,j,ERR_ACT));
}
return Records;
}
sample the CSV file ( only 10 rows) is in the end page but in the LOGFILE I have a different the CSV ( CSV generated by Pandas, no hand ) first 3 row: raw row csv: 1585771200, -3.83582604,-6.10750127,0.62133097,-0.21221686,4.66838855,10.50491382,13.5382894,8.87178578,5.72651148,2.49663162,-3.30909657,-0.62071651,0.08569986,-2.18775678,-2.43944001,-6.54430676,-4.49616098,-4.27246809,-1.8326776,-1.13982177,393,97.06 read like: -1431655766 43922.833333 -3.835826 -6.107502 0.621331 -0.212217 4.668388 10.504914 13.538289 8.871786 5.726511 2.496632 -3.309097 -0.620717 0.085700 -2.187757 -2.439440 -6.544307 -4.496161 -4.272468 -1.832678 393 97.059998 raw row csv: 1585770300,-6.96455475,-3.83582604,-6.10750127,0.62133097,-0.21221686,4.66838855,10.50491382,13.5382894,2.13647079,-4.12107038,0.57740384,-2.6419754,-5.39060307,-4.56053495,-8.72499561,-7.84280062,-8.50998688,-6.68159008,-8.08716202,-2.15325022,117,77.3 read like: 1431655766 43922.822917 -6.964555 -3.835826 -6.107502 0.621331 -0.212217 4.668388 10.504914 13.538289 2.136471 -4.121070 0.577404 -2.641975 -5.390603 -4.560535 -8.724996 -7.842801 -8.509987 -6.681590 -8.087162 117 77.300003 raw row csv: 1585769400, -11.98182458,-6.96455475,-3.83582604,-6.10750127,0.62133097,-0.21221686,4.66838855,10.50491382,-6.30167437,-8.49223232,-6.70035887,-13.30095196,-12.5223732,-15.40606594,-13.41799259,-10.03404617,-14.75043106,-12.59232712,-13.87906456,-16.14548302,85,60.52 read like: 0 43922.812500 -11.981825 -6.964555 -3.835826 -6.107502 0.621331 -0.212217 4.668388 10.504914 -6.301674 -8.492232 -6.700359 -13.300952 -12.522373 -15.406066 -13.417993 -10.034046 -14.750431 -12.592327 -13.879065 85 60.520000
|
|
|
Re: bug in parseData?
[Re: Grat]
#480197
05/26/20 09:22
05/26/20 09:22
|
Joined: May 2015
Posts: 390 Czech Republic
Grat
OP
Senior Member
|
OP
Senior Member
Joined: May 2015
Posts: 390
Czech Republic
|
continue my homework: after change on this:
int loadPredict(const string idx, const string TF, const int nHandle){
string InName = strf("Predikce\\%s_%s_%s.csv",strx(Asset,"/",""),idx,TF); // name of a single year CSV file
string Format = "%t,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,i,f";
int Records = dataParse(nHandle,Format,InName);
int i,j;
for (j=0;j<Records;j++)
{
print(TO_LOG,"\n %d",dataStr(nHandle,j,0));
printf("\n");
for (i=1;i<21;i++)
print(TO_LOG," %f",dataVar(nHandle,j,i));
print(TO_LOG," %d",dataInt(nHandle,j,ERR_WIN));
print(TO_LOG," %f",dataVar(nHandle,j,ERR_ACT));
}
printf("\n\n");
return Records;
}
unixtime index is converted from 1585754100 to 497878664 ( show with print(TO_LOG,"\n %d",dataStr(nHandle,j,0)); ) stil not work the findData fce
int findRow(var dDate,const int nHandle){
int Row = dataFind(nHandle,dDate);
return Row;
}
//1585758600 == 2020-04-01 6:30
var dDateD=wdatef("%Y-%m-%d %H:%M", "2020-04-01 06:30");
int nM15=findRow(dDateD,1); // find the actual row value M15
data OK -7.267618 -4.382970 -8.246713 -9.795797 -8.136627 -7.064792 -6.453411 -0.181064 4.329069 4.081573 5.729965 5.850610 6.440209 3.814275 2.808572 4.838944 3.034771 0.485683 5.303627 0.605268 133 94.449997 find row is = 6 in file: 1585758600,-8.13662674,-7.06479147,-6.45341088,-0.18106396,-2.53993037,-3.07169075,-2.07676956,-6.08936187,-6.19483137,-3.98569345,-6.76299095,-8.66434669,-9.94509506,-7.24448967,-3.73329449,-2.86435819,-6.47179174,-9.75704479,-8.17628479,-9.22965813,315,98.15
Last edited by Grat; 05/26/20 09:25.
|
|
|
Re: bug in parseData?
[Re: Grat]
#480198
05/26/20 09:37
05/26/20 09:37
|
Joined: May 2015
Posts: 390 Czech Republic
Grat
OP
Senior Member
|
OP
Senior Member
Joined: May 2015
Posts: 390
Czech Republic
|
the next point output from:
print(TO_LOG,"\n %d",dataStr(nHandle,j,0));
is every times running script a different 208803448 -> 745965592 -> 208803448 .... possible only two: a) I'm not understand, how work the dataParse b) during the reading fce dataParse wrong translate <b>unixtime</b> to <b>wdate</b> format. In this case not work the dataFind fce
|
|
|
|