Question: Write as a Python beginner. Print output as show for each step for the file below. This is the M 2 . csv file: name
Write as a Python beginner. Print output as show for each step for the file below.
This is the Mcsv file:
name id nametype mass g fall year reclat reclong
Aachen Valid Fell
Aarhus Valid Fell
Abee Valid Fell
Acapulco Valid Fell
Achiras Valid Fell
Read the attached CSV file one line at a time equivalent to one row at a timeskip the first linerow containing the columns names ie
Store the row as a dictionary Python
Store the output of Step into a listarray
Convert the output of Step into JSON
Write the output of Step into a JSON file. Name of output file shoud be output.json
Take the output of Step and convert it into a CSV file. The content will be identical to what was used as input in Step
Lets say I have a CSV file with the following content: this is just example, please make sure the output will look like this and the code should work for the Mcsv file above
IDName,Age
"John Smith",
"Matt Johnson",
"Cindy Colins",
First read this file one linerow at a time skip the first linerow containing the columns names ie
Line "John Smith",
Line "Matt Johnson",
Line "Cindy Colins",
Step : Convert the lines into a dictionarymap print the dictionaries, they should look like the following
ID: 'Name': John Smith" 'Age':
ID: 'Name': Matt Johnson" 'Age':
ID: 'Name': Cindy Colins" 'Age':
Step : Store the dictionaries from Step into a listarrayprint the output of this step it should look like the following
ID: 'Name': John Smith" 'Age': ID: 'Name': Matt Johnson" 'Age': ID: 'Name': Cindy Colins" 'Age':
Step : Use the output of Step and conver it into JSON object. Print the output, should look like the following.
ID: "Name": John Smith "Age": ID: "Name": Matt Johnson "Age": ID: "Name": Cindy Colins "Age":
Step : Store the output of Step into a file output.json The contents of the file is identical to output of Step
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
