Depends on the what format the data is being given to you.  Is it json? csv? If you already know how to import and read the data with python.. you just need to assign the years to variables and average them.  (x1 + x2 + x3) / (number of averaged variables)
I have a dataset that looks like this:




Date
Value




1871-01
4.5


1871-02
10.7


1871-03
8.9


1871-04
1.3




all the way to 2021-12.
how do I get the average value for each year in Python? For example, the 1871 average would be the average of all of the values from 1871-01 to 1871-1 and I would like it for all years from 1871-2021.
...            ...
How do I average monthly data to get yearly values in Python?