{"Name":{"20":"Paul Merrill","21":"Brynne S. Barr","22":"Cyrus Buckley","23":"Chloe Burnett","24":"Zachery Wilcox","25":"Casey Mcgowan","26":"Cole X. Hopper","27":"Tara Bender","28":"Malik...

1 answer below »
Hello I need some help on this assignment. The goal of the assignment is to combine the 3 data files (.csv, .json, .csv) and combine it into 1 csv file called full_data. Then there are a few questions (only 5) regarding the data that I need full_data to print. Only restriction is there is no use of pandas or numPy


{"Name":{"20":"Paul Merrill","21":"Brynne S. Barr","22":"Cyrus Buckley","23":"Chloe Burnett","24":"Zachery Wilcox","25":"Casey Mcgowan","26":"Cole X. Hopper","27":"Tara Bender","28":"Malik Grimes","29":"Ulla Russo","30":"Colby Moran","31":"Maggy Wooten","32":"Cameron Guthrie","33":"Gail Villarreal","34":"Harding Salinas","35":"Idona W. Bonner","36":"Warren Castillo","37":"Clayton Harmon","38":"Alana Vasquez","39":"Mason R. Trujillo"},"Phone":{"20":"1-313-739-3854","21":"939-4818","22":"266-3123","23":"828-0406","24":"1-611-756-4723","25":"1-155-558-4461","26":"1-328-505-0545","27":"1-757-378-4079","28":"793-4359","29":"662-7778","30":"1-788-230-1991","31":"912-7242","32":"988-2217","33":"1-405-823-4207","34":"1-505-843-5401","35":"283-6921","36":"1-250-875-9104","37":"1-609-380-9257","38":"1-853-288-4269","39":"172-5777"},"Address":{"20":"916-8087 Vehicula Rd.","21":"878-2231 Suspendisse Rd.","22":"P.O. Box 572, 7680 Ullamcorper Ave","23":"563-4105 Donec Avenue","24":"462-2112 In Rd.","25":"420-7327 Facilisis Street","26":"561-7476 Eget St.","27":"1247 Nonummy Rd.","28":"Ap #603-3303 Libero. St.","29":"P.O. Box 975, 4593 Ante. Street","30":"3696 Augue Ave","31":"P.O. Box 365, 6109 Metus. Rd.","32":"Ap #861-8699 Non Ave","33":"371-7266 Tortor Avenue","34":"4167 Nunc Ave","35":"Ap #302-2966 Cum Av.","36":"Ap #275-2917 Curabitur Rd.","37":"6930 Duis Road","38":"1511 Lobortis Ave","39":"Ap #711-213 Sagittis Avenue"},"City":{"20":"Le Mans","21":"Wilhelmshaven","22":"Sangli","23":"Wabamun","24":"Barddhaman","25":"Pfungstadt","26":"Saint John","27":"Avellino","28":"Winnipeg","29":"Vit\u00f3ria da Conquista","30":"Hualp\u00e9n","31":"Kapuskasing","32":"Pontypridd","33":"Saint-Remy-Geest","34":"Arsimont","35":"Nieuwenrode","36":"La Baie","37":"College","38":"Richmond Hill","39":"Quinta Normal"},"Country":{"20":"Somalia","21":"Samoa","22":"Taiwan","23":"Morocco","24":"Hong Kong","25":"Iran","26":"Macao","27":"Dominica","28":"Congo (Brazzaville)","29":"Slovakia","30":"France","31":"Indonesia","32":"Turks and Caicos Islands","33":"Marshall Islands","34":"Montserrat","35":"Faroe Islands","36":"Ireland","37":"United States","38":"Israel","39":"Sudan"},"Email":{"20":"[email protected]","21":"[email protected]","22":"[email protected]","23":"[email protected]","24":"[email protected]","25":"[email protected]","26":"[email protected]","27":"[email protected]","28":"[email protected]","29":"[email protected]","30":"[email protected]","31":"[email protected]","32":"[email protected]","33":"[email protected]","34":"[email protected]","35":"[email protected]","36":"[email protected]","37":"[email protected]","38":"[email protected]","39":"[email protected]"}}
Answered 1 days AfterMar 18, 2021

Answer To: {"Name":{"20":"Paul Merrill","21":"Brynne S. Barr","22":"Cyrus Buckley","23":"Chloe...

Ibrahim answered on Mar 20 2021
143 Votes
PythonBigData/collect_data.py
import csv
import json
import pickle

class Person:
def __init__(self):
self.name="";
self.email="";
self.phone="";
self.country="";
self.city="";
self.address="";

def __str__(self):
return self.name+" "+self.city

def main():
persons=[]
with open('data-oat3ad5x-g54sn3lo.csv') as csv_file:
csv_reader = csv.reader(csv_file, delimiter=',')
line_count = 0
for row in csv_reader:
if line_count == 0:
line_count += 1
else:
##print(f'\t{row[0]} {row[1]} {row[2]} {row[3]} {row[4]} {row[5]} {row[6]}')
person=Person()
person.name=row[1]
person.phone=row[2]
person.address=row[3]
person.city=row[4]
person.country=row[5]
person.email=row[6]
persons.append(person)
line_count += 1
#print(person)
count=len(persons)
ind=0
f = open('data-oljas4qv-zon24aqk.json')
data = json.load(f)
for key,value in data.items():
#print(key)
for i,val in value.items():
ind=int(i)
# #print(i+" "+val);
if ind > count:
person=Person()
persons.append(person)
count+=1
person=persons[ind-1]
if key=="Name": person.name=val;
elif key=="Phone": person.phone=val;
elif key=="Address": person.address=val;
elif key=="City": person.city=val;
elif key=="Country": person.country=val;
elif key=="Email": person.email=val;

f.close()
with open('data-0bcpjqu5-b1nfjimt.pkl', 'rb') as f:
data = pickle.load(f)
for key,value in data.items():
#print(key)
for i,val in value.items():
ind=int(i)
if ind > count:
person=Person()
persons.append(person)
count+=1
person=persons[ind-1]
if key=="Name": person.name=val
elif key=="Phone": person.phone=val
elif key=="Address": person.address=val
elif key=="City": person.city=val
elif key=="Country": person.country=val
elif key=="Email": person.email=val
row_list = ["SN", "Name", "Phone","Address","City","Country","Email"]
with open('full_data.csv', 'w', newline='') as file:
writer = csv.writer(file)
writer.writerow(row_list)
j=1
for val in persons:
writer.writerow([j,val.name,val.phone,val.address,val.city,val.country,val.email]);
j+=1
main()
PythonBigData/full_data.csv
SN,Name,Phone,Address,City,Country,Email
1,Hillary Benton,1-243-669-7472,144-1225 In Road,Navsari,Togo,[email protected]
2,Morgan Y. Little,155-3483,Ap #909-6656 Ac St.,Kitimat,Nauru,[email protected]
3,Camden Z. Blair,123-5058,"P.O. Box 441, 6183 Ligula St.",Casanova Elvo,"Palestine, State of",[email protected]
4,Alexandra E. Saunders,1-637-740-7614,305-496 Morbi Rd.,Biggleswade,Malawi,[email protected]
5,Hanae P. Walsh,901-2461,7058 Dapibus St.,Dhuy,Qatar,[email protected]
6,Jescie Sargent,265-1176,421-5501 Cursus. St.,Tulsa,Holy See (Vatican City State),[email protected]
7,Kessie Morgan,945-0713,Ap #481-6631 Vehicula Rd.,Pedro Aguirre Cerda,"Bonaire, Sint Eustatius and Saba",[email protected]
8,Bevis M. Santos,227-9994,"P.O. Box 575, 4033 Mi St.",Saint-Vincent,Kuwait,[email protected]
9,Flynn Alston,398-8097,"Ap #763-5990 Nec, Av.",Tirúa,Romania,[email protected]
10,Charles F. Crawford,791-5111,Ap #841-1623 Vitae Avenue,Hindupur,South Georgia and The South Sandwich Islands,[email protected]
11,Cairo Wolfe,1-930-942-2322,9269 Libero Ave,Whitchurch,Lesotho,[email protected]
12,Elijah Myers,1-238-336-4864,"P.O. Box 677, 2311 Aliquet. Road",Port Harcourt,Kyrgyzstan,[email protected]
13,Thane Burch,1-894-978-3696,"7438 Amet, Rd.",Algeciras,Anguilla,[email protected]
14,Katelyn Munoz,220-5054,"P.O. Box 432, 9085 Nulla Ave",Requínoa,Congo (Brazzaville),[email protected]
15,Genevieve Holland,992-6968,1768 Magna. Road,Moose Jaw,Uruguay,[email protected]
16,Wesley Z. Sharp,1-960-740-2261,"P.O. Box 497, 8354 Habitant St.",Bear,Cayman Islands,[email protected]
17,Tatyana H. French,1-120-782-6047,217-9163 Lobortis Road,Salles,Eritrea,[email protected]
18,Meredith F. Clayton,425-7583,Ap #929-9420 Vivamus Rd.,Friedberg,Czech Republic,[email protected]
19,Rajah Carrillo,1-576-789-5730,910-8300 Varius Rd.,Bertiolo,Afghanistan,[email protected]
20,Paul Merrill,1-313-739-3854,916-8087 Vehicula Rd.,Le Mans,Somalia,[email protected]
21,Brynne S. Barr,939-4818,878-2231 Suspendisse Rd.,Wilhelmshaven,Samoa,[email protected]
22,Cyrus Buckley,266-3123,"P.O. Box 572, 7680 Ullamcorper Ave",Sangli,Taiwan,[email protected]
23,Chloe Burnett,828-0406,563-4105 Donec Avenue,Wabamun,Morocco,[email protected]
24,Zachery Wilcox,1-611-756-4723,462-2112 In Rd.,Barddhaman,Hong Kong,[email protected]
25,Casey Mcgowan,1-155-558-4461,420-7327 Facilisis Street,Pfungstadt,Iran,[email protected]
26,Cole X. Hopper,1-328-505-0545,561-7476 Eget St.,Saint John,Macao,[email protected]
27,Tara Bender,1-757-378-4079,1247 Nonummy Rd.,Avellino,Dominica,[email protected]
28,Malik Grimes,793-4359,Ap #603-3303 Libero. St.,Winnipeg,Congo (Brazzaville),[email protected]
29,Ulla Russo,662-7778,"P.O. Box 975, 4593 Ante. Street",Vitória da Conquista,Slovakia,[email protected]
30,Colby Moran,1-788-230-1991,3696 Augue Ave,Hualpén,France,[email protected]
31,Maggy Wooten,912-7242,"P.O. Box 365, 6109 Metus. Rd.",Kapuskasing,Indonesia,[email protected]
32,Cameron Guthrie,988-2217,Ap #861-8699 Non Ave,Pontypridd,Turks and Caicos Islands,[email protected]
33,Gail Villarreal,1-405-823-4207,371-7266 Tortor Avenue,Saint-Remy-Geest,Marshall Islands,[email protected]
34,Harding Salinas,1-505-843-5401,4167 Nunc Ave,Arsimont,Montserrat,[email protected]
35,Idona W. Bonner,283-6921,Ap #302-2966 Cum Av.,Nieuwenrode,Faroe Islands,[email protected]
36,Warren Castillo,1-250-875-9104,Ap #275-2917 Curabitur Rd.,La Baie,Ireland,[email protected]
37,Clayton Harmon,1-609-380-9257,6930 Duis Road,College,United States,[email protected]
38,Alana Vasquez,1-853-288-4269,1511 Lobortis Ave,Richmond Hill,Israel,[email protected]
39,Mason R. Trujillo,172-5777,Ap #711-213 Sagittis Avenue,Quinta Normal,Sudan,[email protected]
40,Garrison Lindsey,420-1477,"P.O. Box 466, 7919 In Av.",Dunbar,Zambia,[email protected]
41,Jenna Mercado,102-2189,"P.O. Box 484, 9648 Sit Avenue",Pollena Trocchia,Burkina Faso,[email protected]
42,Drake Savage,1-790-105-7695,"P.O. Box 254, 2688 Luctus, Street",Hastings,Tunisia,[email protected]
43,Rana Z. Colon,486-7539,Ap #682-9992 Neque Rd.,Gespeg,Canada,[email protected]
44,Melodie Knox,1-479-861-6093,245-8811 Ut St.,Whitehorse,Norway,[email protected]
45,Cooper T. Horton,768-1000,"P.O. Box 383, 139 A Ave",Fernie,Israel,[email protected]
46,Eaton Nelson,746-8562,7989 Magna Rd.,Ludlow,Cocos (Keeling) Islands,[email protected]
47,Lucian W. Lynn,1-392-783-0634,7312 Tristique St.,Tirrases,Western...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here