Created
August 17, 2012 10:21
-
-
Save seumasmorrison/3377772 to your computer and use it in GitHub Desktop.
Sample input data and python code for Pandas time-series problem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
data_frame = pd.io.parsers.read_csv('time-series.csv',index_col = 0, names=['index','heave']) | |
_max = [[5, 259.0]] | |
indexes = [x[0] for x in _max ] | |
index = data_frame.index | |
timestamps = [index[z] for z in indexes] | |
#['2011-12-30 00:00:04'] | |
print data_frame.ix[timestamps] | |
# heave | |
#2011-12-30 00:00:04 259 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2011-12-30 00:00:00 | -310.0 | |
---|---|---|
2011-12-30 00:00:01 | -238.0 | |
2011-12-30 00:00:01.500000 | -114.0 | |
2011-12-30 00:00:02.500000 | 60.0 | |
2011-12-30 00:00:03 | 185.0 | |
2011-12-30 00:00:04 | 259.0 | |
2011-12-30 00:00:04.500000 | 231.0 | |
2011-12-30 00:00:05.500000 | 139.0 | |
2011-12-30 00:00:06.500000 | 55.0 | |
2011-12-30 00:00:07 | -49.0 | |
2011-12-30 00:00:08 | -144.0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment