Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need help with this Python encoding problem. I need to read and write data using three different data files named: data.csv data.json data.pkl Here is

Need help with this Python encoding problem. I need to read and write data using three different data files named:

  • data.csv
  • data.json
  • data.pkl

Here is the Google public link containing all data files listed above:https://drive.google.com/drive/folders/1OxdpHGxXMWg309NKPvGFb3eMJUv8ubm5?usp=sharing

Each file contains a portion of the total dataset that altogether comprises 100 records, so I need to read in all of the files and combine them into some standard format with which you are comfortable. Aim for something standard where each "row" is represented in the same format. Name this object that contains the data for all three files combinedfull_data

Need answers to following questions:

  1. What are the unique countries in the dataset, sorted alphabetically? Write to a new file called question_1.csv.
  2. What are the unique complete email domains in the dataset, sorted alphabetically? Write to a new file called question_2.csv.
  3. What are the first names of everyone (including duplicates) that do not have a P.O. Box address, sorted alphabetically? Write to a new file called question_3.csv.
  4. What are the full names of the first 5 people when you sort the data alphabetically by country? Write to a new file called question_4.csv.
  5. What are the full names of the first 5 people when you sort the data numerically ascending by phone number? Write to a new file called question_5.csv.

I need to make sure the following points while answering:

  • The answers are all in onecolumnwith one list item per cell, sorted as stated in the question. I.e., looking at the .csv in a spreadsheet editor like Google Sheets, all answers would be in the 'A' column, with the first entry in A1, the second in A2, etc.
  • Please do not include a header; just the answers to the questions.
  • It is strongly recommended that you open each .csv file to ensure the answers are there and displayed correctly!
  • Don't include quotes around the list items. I.e., strip the leading and trailing quotes, if necessary, from items when you write to the .csv files. For example, a list entry should look like Spain rather than "Spain". One exception: Some country names do contain commas and it is ok to have quotes: "" around just those country names so that they will be in one cell in the .csv.

Assumptions

  • You might have to make decisions about the data. For example, what to do with ties or how to sort the phone numbers numerically.
  • Please do some research before making an assumption (e.g. what is a domain name?); put your notes inside that assumption so we can understand your thought process.
  • NOTE: If you don't know what an email domain is - do some research and write what you found in your assumptions; there is a correct answer to this question!
  • This is a good habit as you analyze data so that you can remember why you made the decisions you did and other people can follow your analysis later!

Restrictions

You should use these standard library imports:

import json import csv import pickle 

NOTE: I CANNOT USE PANDAS LIBRARY FOR THIS PROBLEM

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

Introduction to Wireless and Mobile Systems

Authors: Dharma P. Agrawal, Qing An Zeng

4th edition

1305087135, 978-1305087132, 9781305259621, 1305259629, 9781305537910 , 978-130508713

More Books

Students also viewed these Programming questions