def sort_by_mad(data, axis=0):
    """
    Sort genes by mad to select input features
    """
    genes = data.mad(axis=axis).sort_values(ascending=False).index
    if axis == 0:
        data = data.loc[:, (genes)]
    else:
        data = data.loc[genes]
    return data
