subject

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.

ansver
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 22:30, hmontalvo22
Who needs to approve a change before it is initiated? (select two.) -change board -client or end user -ceo -personnel manager -project manager
Answers: 1
image
Computers and Technology, 23.06.2019 09:30, shadowsnake
Write a function called checkfactor that takes two arrays of positive numbers, firstnumberrow and secondnumberrow. checkfactor checks if the first entry in firstnumberrow is divisible by the first entry in secondnumberrow, and performs the same operation on the next array elements until all entries have been checked. all the numbers are positive and the number of entries in the arrays are the same. the function should return the identified divisible numbers in two row arrays named firstdivisible and seconddivisible. restrictions: branches or loops should not be used. the code must use the internal mod and logical functions. hint: the mod function should be used to determine if two numbers are divisible. ex: for num1 and num2 if mod(num1,num2) is 0, then the two numbers are divisible. this is matlab
Answers: 2
image
Computers and Technology, 24.06.2019 08:00, Maxxboogie
Can someone work out the answer as it comes up in one of my computer science exams and i don't understand the cryptovariables
Answers: 1
image
Computers and Technology, 24.06.2019 10:20, silviamgarcia
Write a program that keeps asking the user for new values to be added to a list until the user enters 'exit' ('exit' should not be added to the list). these values entered by the user are added to a list we call 'initial_list'. then write a function that takes this initial_list as input and returns another list with 3 copies of every value in the initial_list. finally, inside print out all of the values in the new list. for example: input: enter value to be added to list: a enter value to be added to list: b enter value to be added to list: c enter value to be added to list: exit output: a b c a b c a b c note how 'exit' is not added to the list. also, your program needs to be able to handle any variation of 'exit' such as 'exit', 'exit' etc. and treat them all as 'exit'.
Answers: 2
You know the right 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
English, 04.02.2022 02:40
Konu
English, 04.02.2022 02:40
Konu
Mathematics, 04.02.2022 02:40