From the course: Complete Guide to Generative AI for Data Analysis and Data Science
Unlock the full course today
Join today to access over 24,800 courses taught by industry experts.
Loading JSON into dataframes
From the course: Complete Guide to Generative AI for Data Analysis and Data Science
Loading JSON into dataframes
- [Instructor] Now, we're going to use ChatGPT to upload data from a JSON file into a Pandas DataFrame. So the first thing I want to do is upload a file from my computer, so I'm going to use products.json. And I'm going to ask ChatGPT to, "Create a script to load data in this JSON file into a DataFrame." (key clicking) Now, let's take a look at this script. What we have at the top here is our import statement, so we're importing the Pandas library and also a library called JSON. So the JSON library has some additional functions that we'll need to map our data from JSON structure into a tabular structure, like a DataFrame. So we have a file path where we specify the location of our products file. Now, if we were to copy this code and run it either in Colab or in say a local environment, we'd have to update the file path to point to wherever we have the products.json file. Now, the next thing we do is we open the file, so we make it readable, so we open it as a readable file, and we use…
Contents
-
-
-
-
-
-
-
-
-
-
-
-
(Locked)
Data files4m 9s
-
Using spreadsheets with CSV files2m 43s
-
(Locked)
Reviewing an example JSON file4m 29s
-
(Locked)
Using jq with JSON files6m 23s
-
(Locked)
Generating jq commands using AI6m 1s
-
(Locked)
Dataframes in Python8m 20s
-
(Locked)
Loading CSV data into dataframes3m 44s
-
(Locked)
Loading JSON into dataframes6m 17s
-
(Locked)
Inspecting dataframes4m 12s
-
(Locked)
Data quality and data cleansing6m 28s
-
(Locked)
Using AI for data quality and data cleansing5m 6s
-
(Locked)
Challenge: Missing data35s
-
(Locked)
Solution: Missing data4m
-
(Locked)
-
-
-
-
-
-
-
-
-