I am new to Pandas. I see it is useful for time series data but only when the sampled interval is a standard unit (eg., minutes, hours, days). What if I have data sampled at much faster but unusual rates such as data acquisition? eg. 512 Hz (sample interval ~1.95 ms)
I can get by without Pandas but just wondered if it is suitable for this type of time series where the sample interval is not an integral number of standard time units.
EDIT: My apologies for being imprecise. I managed to get Pandas to understand engineering-like time series (where we are more used to specifying sampling frequency in Hz than long periods such as days, weeks, months etc) by the following code ...
import pandas as pd
fs = 256. #Hz
period = str(int(round(1000000./fs)))+'U' #microseconds
rng = pd.date_range('1/1/2011', periods=len(dat), freq=period)
serialData = pd.Series(data,index = rng)
Assuming the record started zero hour 1/1/2011 this worked and got the correct sampling frequency.
However, it is not at all obvious from the documentation how to do this.
I also ran into problems when trying to resample the data at 512Hz (double the frequency). I got this error message:
C:\Users\Andrew\Anaconda\lib\site-packages\pandas\core\format.py:1872: RuntimeWarning: invalid value encountered in greater
has_large_values = (abs_vals > 1e8).any() C:\Users\Andrew\Anaconda\lib\site-packages\pandas\core\format.py:1873: RuntimeWarning: invalid value encountered in less has_small_values = ((abs_vals < 10 ** (-self.digits)) & C:\Users\Andrew\Anaconda\lib\site-packages\pandas\core\format.py:1874: RuntimeWarning: invalid value encountered in greater (abs_vals > 0)).any()If I change the sample period from '3906U' to '2S' and resample to '1S' (doubling the sampling frequency) I do not get this error.
My data is 8 million samples long. If I try and plot the Pandas TimeSeries object I get a memory error.
I do not get these problems if I just treat the data as a 1D numpy array. So I think I will stick with numpy for the engineering time-series I normally work with.
PS. My edit was just to try and help anyone trying to do something similar with long data and Hz/KHz/MHz etc. based sampling.