Is it possible to reset columns so they becomes first row of DataFrame. For example,
DataFrame
import pandas as pd df = pd.DataFrame({\'a\': [1, 2, 3], \'b\'
Inserting column names at the first row and resetting the indices.
import pandas as pd df = pd.DataFrame({'a': [1, 2, 3], 'b': [4, 5, 6]}) df.loc[-1] = df.columns df.index = df.index + 1 df = df.sort_index() df.columns = [0,1] df 0 1 0 a b 1 1 4 2 2 5 3 3 6