Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In PYTHON Railway Safety Data Part 2 - Summarize and Visualize The previous problem imported and selected the Norfolk-Southern Railway safety data into an easier

In PYTHON

image text in transcribedimage text in transcribed

Railway Safety Data Part 2 - Summarize and Visualize The previous problem imported and selected the Norfolk-Southern Railway safety data into an easier to use dataset, For this problem use the data file NSData.csV (this should be identical to the file you exported in the first problem). Recall that this file should have 3 comma separated values for each accident: - Year of accident (just the last 2 digits) - Railway Code (should be 'NS' for all the data, since only Norfolk-Southern data was exported) - Accident Type code The Accident Type code corresponds to the following: Write and submit a python program file that will: - Import the year, railway code and accident type data from NSData.cSV (save this file in the same directory as your program file) - Find the total number of each accident type that occurred over the 10 years of data. - Output the result to the console with the accident type description, formatted nicely, starting like (I've provided some sample digits): - Create a bar chart (plot) and display the number of accidents for each accident type. Add a title, legend, and axis labels. You should produce a plot like: Hints: - The accident types and descriptions might make a good dictionary! (as might the number of accidents for each accident type) - For right justifying string values, use the f-string formatting style \{myString:>ns\}, where ' n ' is the number of spaces to align to - We didn't cover bar charts in lecture, however,it's just like plot(), but uses bar (x,y) instead. Just give it the accident type names as the "xvalues" - To "rotate" the x axis labels, just use the xticks(rotation=90) function with your plot

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Heikki Topi, Jeffrey A Hoffer, Ramesh Venkataraman

13th Edition

0134773659, 978-0134773650

More Books

Students also viewed these Databases questions

Question

1. What are the peculiarities of viruses ?

Answered: 1 week ago

Question

Describe the menstrual cycle in a woman.

Answered: 1 week ago

Question

1. Which position would you take?

Answered: 1 week ago