Skip to content
Advertisement

Have the same index for multiple rows in dataframe, shown verticaly

I am trying to create a dataframe that looks similar to an excel file, something like this:

enter image description here

The code I am using right now:

1) Import packages

JavaScript

What I am getting:

enter image description here

What I want to do is have the dataframe show the index vertically, using the same index for 3 consequent rows at a time.

Advertisement

Answer

How about this? I added column R(km)as the expected output you showed but you can apply the same principle for other column as the second index.

JavaScript

enter image description here

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement