Home / Expert Answers / Computer Science / we-will-now-determine-which-status-codes-appear-for-each-request-type-loop-over-the-elements-of-t-pa146

(Solved): We will now determine which status codes appear for each request type. Loop over the elements of t ...



We will now determine which status codes appear for each request type.
Loop over the elements of the req_types list created i

We will now determine which status codes appear for each request type. Loop over the elements of the req_types list created in Part E. For each request type, perform the tasks described below. Attempt to perform steps with a single statement by chaining together RDD methods. 1. Apply a filter to the nasa RDD keeping only elements of the current request type. 2. Extract the status codes for these records. 3. Determine the collection of distinct status codes appearing for this request type. 4. Sort the distinct codes in increasing order. 5. Collect the results into a list. 6. Print a message stating which status codes appear for this request. Your final output should be formatted as follows: Status codes for GET requests: LIST_OF_STATUS_CODES Status codes for HEAD requests: LIST_OF_STATUS_CODES Status codes for POST requests: LIST_OF_STATUS_CODES Next, we will count the number of requests resulting in each status code. Perform the following steps in a single code cell. 1. Create an empty list named code_counts. 2. Loop over the elements of the status_codes list. For each status code, determine the number of requests resulting in that particular status code. Append the resulting count into the code_counts list. 3. Use the contents of status_codes and code_counts to create a bar chart displaying the number of requests resulting in each status code. Construct your bar chart according to the following specifications: a. The figure size should be . b. Select a single named color to use for the bars. Add a black border to each bar. c. The chart should be titled "Distribution of Status Codes" d. The -axis should be labeled "Status Code" and the -axis should be labeled "Count". e. The heights of the bars will be on dramatically different scales. For this reason, we will use a log scale for the -axis. This can be set using plt.yscale ( ' '). f. Use plt.show() to display the figure.


We have an Answer from Expert

View Expert Answer

Expert Answer


We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe