["python","pandas","dataframe"]
How to add a column with values 1 to len(df) to a dataframe

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 add a column which is the series: [1, 2, 3, 4, 5, …, 30] How should I go about doing that?
How about this: from pandas import * idx = Int64Index([171, 174, 173]) df = DataFrame(index = idx, data =([1,2,3])) print df It gives me: 0 171 1 174 2 173 3 Is this what you are looking for?