I have a pandas
series that looks like this:
GameID | PlayID | FrameID | dictionary |
---|---|---|---|
1 | 2 | 1 | {34: 63, 23: 73, 42: 96} |
2 | {34: 63, 23: 73, 42: 94} |
||
1 | 5 | 1 | {62: 63, 25: 73, 72: 94} |
2 | {34: 63, 23: 73, 42: 94} |
||
1 | 2 | 1 | {10: 11, 2: 94, 3: 35} |
2 | {52: 11, 91: 34, 12: 35} |
And want to create a dataframe that would look like this:
GameID | PlayID | FrameID | playerId | opposingId |
---|---|---|---|---|
1 | 2 | 1 | 34 | 63 |
1 | 2 | 1 | 23 | 73 |
1 | 2 | 1 | 42 | 96 |
1 | 5 | 1 | 62 | 63 |
1 | 5 | 1 | 25 | 73 |
1 | 5 | 1 | 72 | 94 |
Is there an easy way to do this?
I've tried converting the list of dictionaries into their own data frame, but because there are so many different keys, it wasn't working as expected. I know with a list, you can use .explode
but that doesn't work with dictionaries.