I have a folder structure that looks like this:
1. data
1.1. ABC
1.1.1 monday_data
monday.json
1.1.2 tuesday_data
tuesday.json
1.2. YXZ
1.2.1 wednesday_data
wednesday.json
1.2.2
etc
I want to unpack all of these json files into a pandas dataframe in python.
I have spend alot of time trying to get this to work, but without success.
What would be the most efficient way to do this?
2
Answers
You can use
rglob
from pathlib.Path to get the path of all files under a directory that end with a certain extensionOutputs
Now you can simple read this data into a dataframe according to your requirements
This is how you can get all paths to your JSON files.
I am not sure how you want to load all of them in a dataframe.
You can try something like this.