0

I have a json line file, where each line has some structure which I am trying to (mostly) flatten, thus:

with open("/home/igor/data/feed.jsonl") as json_file:
    thelist2 = []
    for line in json_file:
        thelist2.append(json_normalize(json.loads(line)))

Followed by pd.concat(thelist2) The semantics of the above is correct, but what is not so good is that this is horrifically slow, while running the above without json_normalize is quite speedy (but does the wrong thing). Is there a way to normalize the dataframe after the fact, or some other speedier scheme?

Igor Rivin
  • 4,632
  • 2
  • 23
  • 35

0 Answers0