# Buggy code
def _rolling_moment(
    arg, window, func, minp, axis=0, freq=None, center=False, args=(), kwargs={}, **kwds
):
    """
    Rolling statistical measure using supplied function. Designed to be
    used with passed-in Cython array-based functions.

    Parameters
    ----------
    arg :  DataFrame or numpy ndarray-like
    window : Number of observations used for calculating statistic
    func : Cython function to compute rolling statistic on raw series
    minp : int
        Minimum number of observations required to have a value
    axis : int, default 0
    freq : None or string alias / date offset object, default=None
        Frequency to conform to before computing statistic
    center : boolean, default False
        Whether the label should correspond with center of window
    args : tuple
        Passed on to func
    kwargs : dict
        Passed on to func

    Returns
    -------
    y : type of input
    """
    arg = _conv_timerule(arg, freq)
    calc = lambda x: func(x, window, minp=minp, args=args, kwargs=kwargs, **kwds)
    return_hook, values = _process_data_structure(arg)
    # actually calculate the moment. Faster way to do this?
    if values.ndim > 1:
        result = np.apply_along_axis(calc, axis, values)
    else:
        result = calc(values)

    rs = return_hook(result)
    if center:
        rs = _center_window(rs, window, axis)
    return rs


# Traceback (AssertionError)
In [118]: import pandas

In [119]: indices = [datetime.datetime(1975, 1, i, 12, 0) for i in range(1, 6)]

In [120]: indices.append(datetime.datetime(1975, 1, 3, 6, 0))  # So that we can have 2 datapoints on one of the days

In [121]: series = pandas.Series(range(1, 7), index=indices)

In [122]: series = series.map(lambda x: float(x))  # Use floats instead of ints as values

In [123]: series = series.sort_index()  # Sort chronologically

In [124]: expected_result = pandas.Series([1.0, 2.0, 6.0, 4.0, 5.0], index=[datetime.datetime(1975, 1, i, 12, 0) for i in range(1, 6)])

In [125]: actual_result = pandas.rolling_max(series, window=1, freq='D')

In [126]: assert((actual_result==expected_result).all())
---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
<ipython-input-126-cc436c4798a7> in <module>()
----> 1 assert((actual_result==expected_result).all())

AssertionError:

In [127]: expected_result
Out[127]:
1975-01-01 12:00:00    1
1975-01-02 12:00:00    2
1975-01-03 12:00:00    6
1975-01-04 12:00:00    4
1975-01-05 12:00:00    5
dtype: float64

In [128]: actual_result
Out[128]:
1975-01-01    1.0
1975-01-02    2.0
1975-01-03    4.5
1975-01-04    4.0
1975-01-05    5.0
Freq: D, dtype: float64

# Fixed code
def _rolling_moment(
    arg,
    window,
    func,
    minp,
    axis=0,
    freq=None,
    center=False,
    how=None,
    args=(),
    kwargs={},
    **kwds,
):
    """
    Rolling statistical measure using supplied function. Designed to be
    used with passed-in Cython array-based functions.

    Parameters
    ----------
    arg :  DataFrame or numpy ndarray-like
    window : Number of observations used for calculating statistic
    func : Cython function to compute rolling statistic on raw series
    minp : int
        Minimum number of observations required to have a value
    axis : int, default 0
    freq : None or string alias / date offset object, default=None
        Frequency to conform to before computing statistic
    center : boolean, default False
        Whether the label should correspond with center of window
    how : string, default 'mean'
        Method for down- or re-sampling
    args : tuple
        Passed on to func
    kwargs : dict
        Passed on to func

    Returns
    -------
    y : type of input
    """
    arg = _conv_timerule(arg, freq, how)
    calc = lambda x: func(x, window, minp=minp, args=args, kwargs=kwargs, **kwds)
    return_hook, values = _process_data_structure(arg)
    # actually calculate the moment. Faster way to do this?
    if values.ndim > 1:
        result = np.apply_along_axis(calc, axis, values)
    else:
        result = calc(values)

    rs = return_hook(result)
    if center:
        rs = _center_window(rs, window, axis)
    return rs