Convert float Series into an integer Series in pandas
Try converting with astype:
new_re_df = [s.iloc[np.where(ts.astype(int) == int(i))] for i in ts]
Edit
On suggestion by @Rutger Kassies a nicer way would be to cast series and then groupby:
rise_p['ts'] = (rise_p.time / 100).astype('int')
ts_grouped = rise_p.groupby('ts')
...
Here's a different way to solve your problem
In [3]: df
Out[3]:
time magnitude
0 1379945444 156.627598
1 1379945447 1474.648726
2 1379945448 1477.448999
3 1379945449 1474.886202
4 1379945699 1371.454224
In [4]: df.dtypes
Out[4]:
time int64
magnitude float64
dtype: object
Convert your epoch timestamps to seconds
In [7]: df['time'] = pd.to_datetime(df['time'],unit='s')
Set the index
In [8]: df.set_index('time',inplace=True)
In [9]: df
Out[9]:
magnitude
time
2013-09-23 14:10:44 156.627598
2013-09-23 14:10:47 1474.648726
2013-09-23 14:10:48 1477.448999
2013-09-23 14:10:49 1474.886202
2013-09-23 14:14:59 1371.454224
Groupby 1min and mean the results (how=
can be an arbitrary function as well)
In [10]: df.resample('1Min',how=np.mean)
Out[10]:
magnitude
time
2013-09-23 14:10:00 1145.902881
2013-09-23 14:11:00 NaN
2013-09-23 14:12:00 NaN
2013-09-23 14:13:00 NaN
2013-09-23 14:14:00 1371.454224