Sep 12, 2024, 8:40 AM
Combined_years_10-16_.xlsx
Missing file
Date column to a datetime format and extracting the year from it. Then, we will aggregate the data by year and visualize the trends for different types of crimes.infer_datetime_format=True parameter in the pd.to_datetime function. This will allow pandas to handle mixed date formats.| Year | ATTEMPTTOCOMMITMURDER | BURGLARY | CRUELTYBYHUSBANDANDRELATIVES | DACOITY | DOWRYPROHIBITIONACT | FATALACCIDENT | GREVIOUSINJURY | HURT | MINORINJURY | ... |
|---|---|---|---|---|---|---|---|---|---|---|
| 2010 | 2042 | 3237 | 1342 | 130 | 35 | 11655 | 6772 | 36822 | 32730 | ... |
| 2011 | 2515 | 3984 | 1551 | 188 | 57 | 13430 | 8250 | 38193 | 39930 | ... |
| 2012 | 3318 | 4897 | 2333 | 171 | 58 | 15952 | 9727 | 32925 | 46717 | ... |
| 2013 | 3459 | 5752 | 2915 | 140 | 57 | 15302 | 10971 | 31238 | 46014 | ... |
| 2014 | 3754 | 6488 | 2434 | 178 | 74 | 15470 | 16319 | 30305 | 50791 | ... |
Date column was included in the aggregation, and datetime64 type does not support sum operations. To resolve this, we need to exclude the Date column before performing the aggregation.| DayOfWeek | ATTEMPTTOCOMMITMURDER | BURGLARY | CRUELTYBYHUSBANDANDRELATIVES | DACOITY | DOWRYPROHIBITIONACT | FATALACCIDENT | GREVIOUSINJURY | HURT | MINORINJURY | ... |
|---|---|---|---|---|---|---|---|---|---|---|
| Monday | 3541 | 5829 | 2080 | 175 | 71 | 16723 | 15228 | 35490 | 49899 | ... |
| Tuesday | 3171 | 5416 | 2248 | 178 | 98 | 14681 | 14905 | 32919 | 47945 | ... |
| Wednesday | 3023 | 5101 | 2171 | 170 | 99 | 14431 | 14250 | 31291 | 45881 | ... |
| Thursday | 3050 | 5514 | 2275 | 162 | 111 | 14380 | 14197 | 30975 | 46297 | ... |
| Friday | 2928 | 5089 | 2127 | 167 | 103 | 14418 | 14130 | 30618 | 45441 | ... |
| Year | ATTEMPTTOCOMMITMURDER | BURGLARY | CRUELTYBYHUSBANDANDRELATIVES | DACOITY | DOWRYPROHIBITIONACT | FATALACCIDENT | GREVIOUSINJURY | HURT | MINORINJURY | ... |
|---|---|---|---|---|---|---|---|---|---|---|
| 2010 | 2042 | 3237 | 1342 | 130 | 35 | 11655 | 6772 | 36822 | 32730 | ... |
| 2011 | 2515 | 3984 | 1551 | 188 | 57 | 13430 | 8250 | 38193 | 39930 | ... |
| 2012 | 3318 | 4897 | 2333 | 171 | 58 | 15952 | 9727 | 32925 | 46717 | ... |
| 2013 | 3459 | 5752 | 2915 | 140 | 57 | 15302 | 10971 | 31238 | 46014 | ... |
| 2014 | 3754 | 6488 | 2434 | 178 | 74 | 15470 | 16319 | 30305 | 50791 | ... |
| Date | ARIMA | BSTS | Transformer |
|---|---|---|---|
| 2017-01-01 | 18.68 | 18.16 | 0.024 |
| 2017-01-02 | 18.62 | 18.44 | 0.024 |
| 2017-01-03 | 18.46 | 18.21 | 0.024 |
| 2017-01-04 | 18.74 | 18.30 | 0.024 |
| 2017-01-05 | 18.81 | 18.70 | 0.024 |
KeyError: 'y', which suggests that the model is unable to find the target column 'y' in the dataframe.KeyError: 'y', which indicates that the NeuralProphet model is unable to find the target column 'y' in the dataframe. This error occurs because the dataframe passed to the NeuralProphet model is not correctly formatted.KeyError: 'y', which indicates that the NeuralProphet model is unable to find the target column 'y' in the dataframe. This error occurs because the dataframe passed to the NeuralProphet model is not correctly formatted.KeyError: 'y', which indicates that the NeuralProphet model is unable to find the target column 'y' in the dataframe. This error occurs because the dataframe passed to the NeuralProphet model is not correctly formatted.KeyError: 'y', which suggests that the model is unable to find the target column 'y' in the dataframe.