Skip to content
Advertisement

Grouped pandas dataframe from nested list

I have a nested list in this format mydata=[[01/01/20,['point1','point2','point3,...]],[02/01/20,['point1','point2','point3']],...] I want to create a pandas dataframe grouped by date with every point as a different row. I have tried manually adding each row through a for loop, but other than taking more than an hour, the dataframe ended up being empty. Not sure how to go about this. Can I create the grouped dataframe directly from the list?

My desired output would be:

JavaScript

Advertisement

Answer

The expected output is not fully clear, but if I guess correctly:

JavaScript

Or:

JavaScript

output:

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