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 01:30
Someone wishes to run the software on another computer system that runs an operating system that does not support the software what can he do
Answers: 3
question
Computers and Technology, 22.06.2019 01:40
When the pc version of the spreadsheet program became available, the ibm pc quickly became the top-selling personal computer?
Answers: 3
question
Computers and Technology, 23.06.2019 09:30
Which of the following tasks is an audio technician most likely to perform while working on a nature documentary? (select all that apply). eliminating potentially distracting background noise adding sound effects making sure the lighting is adequate for a particular scene changing the narration to better match the mood of the documentary
Answers: 3
question
Computers and Technology, 23.06.2019 14:00
Select the correct answer. a company is currently focusing on creating specific management goals for itself. which level of maturity is the company demonstrating under the sse_ccm framework? a. performed informally b. planned and tracked c. quantitatively controlled d. well-defined e. continuously improving
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, 01.04.2021 19:00
question
Mathematics, 01.04.2021 19:00
question
Mathematics, 01.04.2021 19:00
question
Mathematics, 01.04.2021 19:00
Questions on the website: 13722361