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

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 14:40
You begin your first day of responsibilities by examining the recent is security breach at gearup to get ideas for safeguards you will take. at gearup, criminals accessed the company's improperly-secured wireless system and stole customers' credit card information as well as employee social security numbers. what kind of computer crime did gearup face?
Answers: 3
question
Computers and Technology, 23.06.2019 00:00
How do we use the sumif formula (when dealing with different formats) ?
Answers: 1
question
Computers and Technology, 23.06.2019 08:00
Michael has written an e-mail to his employees that describes a new product special that will be introduced to the customers next week. by taking time to make sure the e-mail is well written, logical, and organized, michael has made sure his message has the characteristics of a) effective communicationb) ineffective communicationc) barriers to communicationd) workplace communication
Answers: 2
question
Computers and Technology, 23.06.2019 10:50
Your friend kayla is starting her own business and asks you whether she should set it up as a p2p network or as a client-server network. list three questions you might ask to kayla decide which network to use and how her answers to those questions would affect your recommendation.
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
question
Mathematics, 22.02.2020 21:24
question
Mathematics, 22.02.2020 21:25
question
Mathematics, 22.02.2020 21:25
Questions on the website: 13722363