I\'m trying to swap the rows within the same DataFrame in pandas.
I\'ve tried running
a = pd.DataFrame(data = [[1,2],[3,4]], index=range(2), columns
The accepted answer does not make changes the index name.
If you only want to alter the order of rows you should use dataframe.reindex(arraylike). Notice that the index has changed.
dataframe.reindex(arraylike)