<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def tn_mean(tasmin, freq='YS'):
 r"""Mean minimum temperature. Mean of daily minimum temperature. Parameters tasmin : xarray.DataArray Minimum daily temperature [℃] or [K] freq : str, optional Resampling frequency Returns ------- xarray.DataArray Mean of daily minimum temperature. Notes ----- Let :math:`TN_{ij}` be the minimum temperature at day :math:`i` of period :math:`j`. Then mean values in period :math:`j` are given by: .. math:: TN_{ij} = \frac{ \sum_{i=1}^{I} TN_{ij} }{I} """


    arr = tasmin.resample(time=freq) if freq else tasmin
    return arr.mean(dim='time', keep_attrs=True)