How can I convert rows to column using VBA or Python?

Excel Example

I need to convert the table at the top, which consists of rows for 1 single flight. I have no idea where to start to create a VBA or Python script to transpose it to get the format like the graph at the bottom, any ideas? I am still very new to coding and data manipulation and appreciate your help.


You can use the pandas pivot_table to do the above work.

Here is an example:

from pandas import DataFrame, read_excel

df = read_excel(<your_file.xlsx>)
altered_df=df.pivot_table(values=['Timestamp'],columns=['Type'], index=[<rest_of_your_columns_that_you_want_to_retain>])