Question
Question: We need to get the data from the file assets/companies_small_set.data into a DataFrame. The problem is that the data on each line of the
Question: We need to get the data from the file assets/companies_small_set.data into a DataFrame. The problem is that the data on each line of the file is in either a JSON or Tab-separated values (TSV) format.
The JSON lines are in the correct format, they just need to be converted to native Python dicts.
The TSV lines need to be converted in to dicts that match the JSON format.
Write a generator gen_fixed_data that takes an iterator as an arguement.
It should parse the values in the iterator and yield each value in the correct format: A dict with the keys:
company
catch_phrase
phone
timezone
client_count
import json
def gen_fix_data(data_iterator):
# YOUR CODE HERE
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started