The index that I have in the dataframe (with 30 rows) is of the form:
Int64Index([171, 174,173, 172, 199..............
....175, 200])
The index is not strictly increasing because the data frame is the output of a sort().
I want to have add a column which is the series:
[1, 2, 3, 4, 5......................., 30]
How should I go about doing that?
Thanks.
解决方案
How about this,
from pandas import *
idx = Int64Index([171, 174, 173])
df = DataFrame(index = idx, data =([1,2,3]))
print df
gives me,
0
171 1
174 2
173 3
Is this what you are looking for?