I have a dataset similar to the following:
SNAPSHOT_DATE DEPLOYMENT_TYPE FORECAST_YEAR TOTAL_WIDGETS
1/1/20 1 2020 206457
1/1/20 1 2021 70571
1/1/20 1 2022 46918
1/1/20 1 2023 36492
1/1/20 1 2024 0
1/1/20 1 2025 0
2/1/20 1 2020 207177
2/1/20 1 2021 71947
2/1/20 1 2022 46918
2/1/20 1 2023 36492
2/1/20 1 2024 0
2/1/20 1 2025 0
3/1/20 1 2020 242758
3/1/20 1 2021 102739
3/1/20 1 2022 43174
3/1/20 1 2023 32956
3/1/20 1 2024 0
3/1/20 1 2025 0
1/1/20 2 2020 286616
1/1/20 2 2021 134276
1/1/20 2 2022 87674
1/1/20 2 2023 240
1/1/20 2 2024 0
1/1/20 2 2025 0
2/1/20 2 2020 308145
2/1/20 2 2021 132996
2/1/20 2 2022 87674
2/1/20 2 2023 240
2/1/20 2 2024 0
2/1/20 2 2025 0
3/1/20 2 2020 218761
3/1/20 2 2021 178594
3/1/20 2 2022 87674
3/1/20 2 2023 240
3/1/20 2 2024 0
3/1/20 2 2025 0
I want to be able to plot for each deployment type, Total Widgets on the y axis and the months (Jan 1 '20 - Dec 1 '20) on the x axis then include a separate line in the plot for each forecasted year 2020-2025. How can I best accomplish this? my first thought was to filter each deployment type based on Date range and forecasted year like this:
forecastchanges_widgets2020 = data.loc[((data['DEPLOYMENT_TYPE'] =='1') & (data['Date'] >= '2020-01-01') & (data['Date'] <= '2020-12-01')) & (data['FORECAST_YEAR'] =='2020')]
and plot each line, but that would mean I would need to repeat that for each year contained within each deployment type. There must be a better way to achieve the desired plot?
This question / answers does not match my requirements, because I need to separate out each deployment type into its own plot and then plot the 'total_widgets' value for each year across the month dates on the x axis
