python - Fit Data in Pandas DataFrame -


i querying database few variables experiment, 1 @ time , storing data in pandas dataframe. can data need, looks below instance:

     file       time    variableid  data 0      1      1503657        1       11 1      1      1503757        1       22 

there data several variables grabbing this, , combining them single dataframe output csv. each variable's data column added new column corresponding name of variable (as file_id should same). time column values might different (one df longer other, data wasn't sampled @ of same times, etc), if merge tables on time (and file) column, discrepancies filled in nan (and fill them in df.fillna(0)) , df can resorted time.

what need though way filter data fits rate, such every 100 milliseconds (1503700,1503800,...). datapoint doesn't have fit rate (and in fact data falls on time ends in 00 instance), should closest matching data time (it closest before or after time actually, long consistent throughout).

i thought iterating on values in time column , adding row closest time 1 one (i first create blank df desired times), there 50,000+ rows in sample table. found answer interpolating (link below), don't want add or modify of data itself, pull rows closely match rate want sample data (one reason of data binary , wouldn't want end 0.5 because before desired time , after desired time values 0 , 1). appreciated, thanks.

combining pandas dataframes of different sampling rates


Comments

Popular posts from this blog

c++ - No viable overloaded operator for references a map -

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - Cannot secure connection using TLS -