<commit_before>.. _monthly means example:

Calculating Seasonal Averages from Timeseries of Monthly Means
==============================================================

Author: `<NAME> <https://github.com/jhamman/>`__

The data used for this example can be found in the
`xarray-data <https://github.com/pydata/xarray-data>`__ repository.

Suppose we have a netCDF or xarray Dataset of monthly mean data and we
want to calculate the seasonal average. To do this properly, we need to
calculate the weighted average considering that each month has a
different number of days.

Suppose we have a netCDF or ``xarray.Dataset`` of monthly mean data and
we want to calculate the seasonal average. To do this properly, we need
to calculate the weighted average considering that each month has a
different number of days.

.. code:: python

    %matplotlib inline
    import numpy as np
    import pandas as pd
    import xarray as xr
    from netCDF4 import num2date
    import matplotlib.pyplot as plt

    print("numpy version  : ", np.__version__)
    print("pandas version : ", pd.__version__)
    print("xarray version : ", xr.__version__)<commit_msg>DOC: remove repeated paragraph (#1448)<commit_after>.. _monthly means example:

Calculating Seasonal Averages from Timeseries of Monthly Means
==============================================================

Author: `<NAME> <https://github.com/jhamman/>`__

The data used for this example can be found in the
`xarray-data <https://github.com/pydata/xarray-data>`__ repository.

Suppose we have a netCDF or ``xarray.Dataset`` of monthly mean data and
we want to calculate the seasonal average. To do this properly, we need
to calculate the weighted average considering that each month has a
different number of days.

.. code:: python

    %matplotlib inline
    import numpy as np
    import pandas as pd
    import xarray as xr
    from netCDF4 import num2date
    import matplotlib.pyplot as plt

    print("numpy version  : ", np.__version__)
    print("pandas version : ", pd.__version__)
    print("xarray version : ", xr.__version__)
{'fraction_non_alphanumeric': 0.12703739213806328, 'fraction_numerical': 0.003835091083413231, 'mean_word_length': 4.1786600496277915, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '642238', 'n_tokens_mistral': 585, 'n_tokens_neox': 549, 'n_words': 248}