2

Problem:

Let there be a dataframe with multiple columns,

A  |  B  |  C  | ....
2  |  b  |  c  |
3  |  c  |  b  |
.
.
.

where A, B and C are the headers

Output:

   |     |     |....
A  |  B  |  C  | 
2  |  b  |  c  |
3  |  c  |  b  |
.
.
.

Is there an efficient way to add an empty row over the header row in the dataframe?

I have found a way to add an empty row right after the header row but I am able to find a way to add an empty row over the header row. Any help would be appreciated.

royalewithcheese
  • 402
  • 4
  • 17

1 Answers1

0

Did you try after adding - sorting?:

df = df.sort_values(by='B')
gtomer
  • 5,643
  • 1
  • 10
  • 21