Skip to content
Advertisement

Python: Rows to Column in Pandas Dataframe

I have following dataframe:

JavaScript

Out:

JavaScript

There are different metrics at column “metric_name” with its own value. To have a better dataset for time series forecasting I want to convert my Dataframe. I want every single metric in “metric_name” as new column in the dataset.

See here all different metrics in “metric_name”:

JavaScript

Out:

JavaScript

What can I do to solve this?

I tried this, but it is not giving me the values, just the counts:

JavaScript

I want the DF to look something like this: enter image description here Thanks!

Advertisement

Answer

If I got you right:

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