Skip to content

Instantly share code, notes, and snippets.

@billmetangmo
Created November 14, 2021 23:47
Show Gist options
  • Select an option

  • Save billmetangmo/09b3c2e24a1a579d14e1ea9269467e3b to your computer and use it in GitHub Desktop.

Select an option

Save billmetangmo/09b3c2e24a1a579d14e1ea9269467e3b to your computer and use it in GitHub Desktop.
Read a file with one json per line with pandas
import pandas as pd
df = pf.read_json("chemin",lines=True)
df.columns.values
df["Useridentity"] # contient du json imbriqué
df["Useridentity"].apply(df.Series)
df["Useridentity"].apply(df.Series).columns.values # ce df a les jsons imbriqués comme colonnes
fdf = df[df["Useridentity"].apply(df.Series)["arn"].isna()] # récupéer le df avec tous ceux qui sont Nan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment