Computers and Technology

A lot of data science work often involves plumbing, the process of getting messy data into a more useful format. Data plumbing is the focus of stage 1. We'll develop and test three functions that will be helpful in stage 2: get_mapping(path): this loads a file that can be used to lookup names from IDs
get_raw_movies(path): this loads movie data with info represented using IDs
get_movies(movies_path, mapping_path): this uses the other two functions to load movie data, then replace IDs with names
Start by writing a function that starts like this:
def get_mapping(path):
When called, the path should refer to one of the mapping files (e. g., "small_mapping. csv"). The function should return a dictionary that maps IDs (as keys) to names (as values), based on the file referenced by path. For example, this code:
mapping = get_mapping("small_mapping. csv")
print(mapping)
Should print this:
{
"nm0000131": "John Cusack",
"nm0000154": "Mel Gibson",
"nm0000163": "Dustin Hoffman",
"nm0000418": "Danny Glover",
"nm0000432": "Gene Hackman",
"nm0000997": "Gary Busey",
"nm0001149": "Richard Donner",
"nm0001219": "Gary Fleder",
"nm0752751": "Mitchell Ryan",
"tt0093409": "Lethal Weapon",
"tt0313542": "Runaway Jury"
}
Note that the mapping files do not have a CSV header, so hardcoding the column indexes is OK in this case.
The following questions pertain to small_mapping. csv unless otherwise specified.
Q1: What is returned by your get_mapping("small_mapping. csv") function?
In addition to displaying the result in the Out [N] area, keep the result in a variable for use in subsequent questions.

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 14:30, kodak0531
Which of the following would not be considered a pc? a. mainframe b. desktop c. tablet pc d. laptop
Answers: 2
image
Computers and Technology, 23.06.2019 15:30, PlzNoToxicBan
The song about casey jones a railroad engineer who gives his life on the job would most likely gall under the folk song category of? a-work song b-nonsense song c-religious song d-ballad
Answers: 1
image
Computers and Technology, 23.06.2019 16:00, ginaaa20
Which analyst position analyzes information using mathematical models to business managers make decisions?
Answers: 1
image
Computers and Technology, 24.06.2019 13:30, sweeps8758
Which type of excel chart should be used to track students’ progress on test grades? line column bar pie
Answers: 2
Do you know the correct answer?
A lot of data science work often involves plumbing, the process of getting messy data into a more us...

Questions in other subjects:

Konu
Mathematics, 10.11.2020 21:30
Konu
Mathematics, 10.11.2020 21:30
Konu
Mathematics, 10.11.2020 21:30