Auto Increment Option for Pandas DataFrame Index

Is there a way to set a parameter to automatically increase the pandas.DataFrame index when adding new rows or define a function to control the creation of new indexes?

+8
python pandas append indexing row
source share
1 answer

You can set ignore_index=True when append -ing:

 In [1]: df = pd.DataFrame([[1,2],[3,4]]) In [2]: row = pd.Series([5,6]) In [3]: df.append(row, ignore_index=True) Out[3]: 0 1 0 1 2 1 3 4 2 5 6 
+14
source share

All Articles