def test_cummax_masked():
    data = [1, 2, None, 4, 5]
    float_types = ['float32', 'float64']
    int_types = ['int8', 'int16', 'int32', 'int64']

    for type_ in float_types:
        gs = Series(data).astype(type_)
        ps = pd.Series(data).astype(type_)
        assert_eq(gs.cummax(), ps.cummax())

    for type_ in int_types:
        expected = pd.Series([1, 2, -1, 4, 5]).astype(type_)
        gs = Series(data).astype(type_)
        assert_eq(gs.cummax(), expected)
def test_cummax(dtype, nelem):
    if dtype == np.int8:
        # to keep data in range
        data = gen_rand(dtype, nelem, low=-2, high=2)
    else:
        data = gen_rand(dtype, nelem)

    decimal = 4 if dtype == np.float32 else 6

    # series
    gs = Series(data)
    ps = pd.Series(data)
    np.testing.assert_array_almost_equal(gs.cummax(), ps.cummax(),
                                         decimal=decimal)

    # dataframe series (named series)
    gdf = DataFrame()
    gdf['a'] = Series(data)
    pdf = pd.DataFrame()
    pdf['a'] = pd.Series(data)
    np.testing.assert_array_almost_equal(gdf.a.cummax(), pdf.a.cummax(),
                                         decimal=decimal)