'Upsampling high rate data using pandas
Yes, you read that correctly. I want to upsample multi-hertz data, by a factor of 5. I have a spreadsheet with dozens of columns and thousands of rows, I would like to upsample all the data at once. So I cracked open the pandas web pages and tutorials. I read the csv file in with pandas "read_csv", then used the floating point seconds column to create a datetime-like column and set that as the index, since it seems to want that.
Then I tried both "resample" and "asfreq" on it, e.g. df.resample("Xms").sum() and df.asfreq(freq="Xms"), where X is the number of milliseconds I want to upsample to. Resample filled all the rows in between with zeros, and "interpolate" won't touch those. "asfreq" has my first data row, followed by rows of NaNs, but my subsequent data rows seem to have disappeared! Note the floating point seconds values were not necessarily on clean Xms boundaries. And yet when I interpolate that data, it becomes meaningful again (albeit for some reason it only gave me the first 25k points) I have no idea how...
I note with dismay that all of examples I find for this function relate to data taken over hours, days, weeks, months, years...so I'm beginning to think this isn't the right way to go about it... does anyone have tips to help me understand what I'm seeing / how to proceed? Thanks.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
