Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I am currently trying to familiarize myself with python, I am trying to work with a JSON file I have my base code started and

I am currently trying to familiarize myself with python, I am trying to work with a JSON file

I have my base code started and trying to branch off.

Any assistance will help

Here is what I am suppose to output:

{

"show_id": id,

"title": title,

"director": director,

"country": country,

"date_added": date_added,

"duration": duration

}

Here is what the csv file looks like. I am showing a couple of examples but the list is over 700.

image text in transcribed

These are my requirements that I am trying to accomplish:

I have to use the data while using CSV library in Python

I get the subsets of "TV Show" in the type field

Then from that subset, I keep these fields (ex: show_id, title, director, and etc.)

And I also have to sort them in descending order based on the number of seasons (duration field)

I have to write the data to a JSON file and use python JSON library ( I can only use csv and python libraries)

Here is my code so far, please DO NOT try changing my code please just help me try to fix it or add certain things. Thanks, anything helps. I just need extra help figuring it out.

image text in transcribed

B C D E F G H . title 1 2 3 4. 5 6 A show_id s1 s2 s3 54 s5 type TV Show Movie Movie Movie Movie director cast country date_adde release_ye rating 3% Joo Migu Brazil ## 2020 TV-MA 7:19 Jorge Mich Demin Bi Mexico ## 2016 TV-MA 23:59 Gilbert Ch: Tedd Char Singapore ## #### 2011 R 9 Shane Ack Elijah Woo United Sta ## 2009 PG-13 21 Robert Lut Jim Sturge United Sta 1-Jan-20 2008 PG-13 K L M N P R S T U duration listed in description 4 Seasons Internation in a future where the elite inhabit an island paradise far from the crowded slums, you get one chance to join the 3 93 min Dramas, Ir After a devastating earthquake hits Mexico City, trapped survivors from all walks of life wait to be rescued while tr 78 min Horror Mo When an army recruit is found dead, his fellow soldiers are forced to confront a terrifying secret that's haunting th 80 min Action & A In a postapocalyptic world, rag-doll robots hide in fear from dangerous machines out to exterminate them, until a 123 min Dramas A brilliant group of students become card-counting experts with the intent of swindling millions out of Las Vegas c import csv def get_data(): 4 0 00 00 W NP stuff=[] with open("netflix_titles.csv) as csv_files: csv_reader=csv.DictReader(csv_file) for row in csv_reader: if(row['type'] "TV Show"): dict1={} 7 ==

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Microsoft SQL Server 2012 Unleashed

Authors: Ray Rankins, Paul Bertucci

1st Edition

0133408507, 9780133408508

More Books

Students also viewed these Databases questions