Shaping the dataset:
- To see the gunshot trend by year we need to group by the dataset with each year and count the number of rows using the unique identifier “id”.
- We can plot interactive plots using a library called “Plotly”. Each plot is a “trace” in the plot and that goes into the figure object.
- We can save the plot as an image file or html file.
Interpretations from the above line plot:
- From the above plot, we can say that the victims are being killed more and more every year.
- The lowest kill rate was in 2016 with <1000 people it has drastically increased to <1050 people in the year 2021.
- From 2021 we can observe a downtrend.