I am working with survey data loaded from an h5-file as hdf = pandas.HDFStore(\'Survey.h5\') through the pandas package. Within this DataFrame, all
hdf = pandas.HDFStore(\'Survey.h5\')
DataFrame
If you already know the index you can use .loc:
.loc
In [12]: df = pd.DataFrame({"a": [1,2,3,4,5], "b": [4,5,6,7,8]}) In [13]: df Out[13]: a b 0 1 4 1 2 5 2 3 6 3 4 7 4 5 8 In [14]: df.loc[[0,2,4]] Out[14]: a b 0 1 4 2 3 6 4 5 8 In [15]: df.loc[1:3] Out[15]: a b 1 2 5 2 3 6 3 4 7