I have a DataFrame object similar to this one:
onset length
1 2.215 1.3
2 23.107 1.3
3 41.815 1.3
4 61.606 1.3
...
What I would like to do is insert a row at a position specified by some index value and update the following indices accordingly. E.g.:
onset length
1 2.215 1.3
2 23.107 1.3
3 30.000 1.3 # new row
4 41.815 1.3
5 61.606 1.3
...
What would be the best way to do this?
df1 = pd.DataFrame(np.insert(df1.values, index+1, values=[" "] * len(df1.columns), axis=0),columns = df1.columns)