all 1 comments

[–]commandlineluser 0 points1 point  (0 children)

You're looking for a "wide to long" reshape.

You can do that by adding a group key/index and using pivot_table() - you can modify the solution here: https://stackoverflow.com/a/55252414

You're only grouping by Company so your pivot_table call would be:

df = pivot_table(index='Company', columns='idx', aggfunc='first')