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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!