def resample(df, rule, how=None, **kwargs):
    """
    Extends pandas resample methods to index made of integers
    """
    import pandas as pd
    if how == None:
        import numpy as np
        how = np.mean
    if isinstance(df.index, pd.DatetimeIndex) and isinstance(rule, str):
        return df.resample(rule, how, **kwargs)
    else:
        s = (df.index.to_series() / rule).astype(int)
        aux = df.groupby(s).apply(how).set_index(s.index[::rule])
        return aux
