Question: import pandas as pd import matplotlib.pyplot as plt # Assume 'dataset' is the name Power BI assigns to the imported dataset DF = dataset #

import pandas as pd import matplotlib.pyplot as plt # Assume 'dataset' is the name Power BI assigns to the imported dataset DF = dataset # Ensure the data is in the correct format DF['year'] = DF['year'].astype(int) DF['accident count'] = DF['accident count'].astype(int) # Group by year and sum the accident counts annual_accidents = DF.groupby('year')['accident count'].sum().reset_index() # Create the plot plt.figure(figsize=(10, 6)) plt.plot(annual_accidents['year'], annual_accidents['accident count'], marker='o') plt.title('Accident Count per Year') plt.xlabel('Year') plt.ylabel('Accident Count') plt.grid(True) plt.xticks(annual_accidents['year'], rotation=45) # Display the plot plt.show()

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Mathematics Questions!