Skip to content

Instantly share code, notes, and snippets.

@idling-mind
Created July 15, 2020 22:51
Show Gist options
  • Save idling-mind/12ac462d9076f90675805502e0f08ffd to your computer and use it in GitHub Desktop.
Save idling-mind/12ac462d9076f90675805502e0f08ffd to your computer and use it in GitHub Desktop.
import pandas as pd
# Convert the list of dict into a dataframe.
df = pd.DataFrame(items)
# Taking the column mediaMetadata and splitting it into individual columns
dfmeta = df.mediaMetadata.apply(pd.Series)
# Combining all the different columns into one final dataframe
photos = pd.concat(
[
df.drop('mediaMetadata', axis=1),
dfmeta.drop('photo', axis=1),
dfmeta.photo.apply(pd.Series)
], axis=1
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment