Question: Perform the following steps in a single code cell. 1 . Create a function named process _ row ( ) . This function should accept
Perform the following steps in a single code cell.
Create a function named processrow This function should accept a single parameter named row, which is intended to represent individual elements of the nasaraw RDD The function should perform the follow processing tasks on the string contained in row, in the order described.
a Use the string replace method to replace double quotes with empty strings.
b Tokenize the string on space characters using the split method.
c If the last token indicating bytes is equal to a hyphen, replace it with
d Coerce the bytes token to an integer. Note that the status code could be interpreted as an integer, but we will leave it as a string to more easily reflect that this is categorical information
e Return the resulting list of tokens.
Apply the processrow function to the elements of nasaraw to create a new RDD named nasa. The new RDD should contain the same number of elements as nasaraw, but these elements should be lists instead of strings.
Persist the nasa RDD to memory.
Print the first elements of the nasa RDD with each element appearing on a different line of
output.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
