My dataframe
Items Count ScannedCount
0 {'comp': {'S': '2019-08-02'}... 1032 1032
1 {'comp': {'S': '2019-08-27'}... 1032 1032
The items series looks like this
{'comp': {'S': '2019-08-02T16:54:55.035196+03:00'}, 'ID': {'S': '336'}, 'dID': {'S': '1763523'}, 'fname': {'S': '558012'}}
Using the second answer from this post allows me to convert the series to a dataframe. The issues is how to scale that operation since it happens on each row,
Current approach:
Looping through each row and concat them into a series (very slow)
item_df = pd.DataFrame(df['Items'].iloc[i]) for i in range(df.shape[0])]).reset_index(drop=True), df], axis=1)
Concat the results with the original dataframe
df = pd.concat([temp, df], axis=1)
I believe the for loop in the first part is the bottleneck.
Is there a faster way to convert a series to dataframe and concat it back to the original dataframe.
Expected output:
comp ID dID fname Count ScannedCount
0 2019-08-02T16:54:55 336 1763523 548012 1032 1032
1 2019-09-01T14:52:24 336 1763523 528012 1032 1032