0

I have this data:

        index       2020-08-26 16:20:00  2020-08-26 19:09:00    2020-08-26 20:04:00
0       start       230                  104                    64
1       stop        228                  185                    170
2       avail       None                 None                   None
3       Status      False                False                  False

And I want to convert it to this form:

    index                start   stop  avail  Status
0   2020-08-26 16:20:00  230     228   None     False
1   2020-08-26 19:09:00  104     185   None     False
2   2020-08-26 20:04:00  64      170   None     False

I have applied

df.T

But I got an output as:

                    0       1       2        3
index               start   stop    endtime  status
2020-08-26 16:20:00 230     228     None     False
2020-08-26 19:09:00 104     185     None     False
2020-08-26 20:04:00 64      170     None     False

I want index, start, stop, endtime, status as column names

1 Answers1

0

You did not provide code for the transition, but after it is made you can rename the columns:

df.rename(columns={"0": "start", "1": "stop", "2": "end time", "3": "status"})

And then delete the first row:

df.drop(df.index[:1], inplace=True)
gtomer
  • 5,643
  • 1
  • 10
  • 21