def int_n_components(nbcolumns, n_components):
    """ convert n_component into a number of component

    Parameters
    ----------
    nbcolumns : int
        number of columns in X

    n_component : int or float
        setted number of columns to convert to int
    """
    if n_components < 1 or isinstance(n_components, float
        ) and n_components == 1.0:
        n_components = min(max(int(nbcolumns * n_components), 1), nbcolumns - 1
            )
    else:
        n_components = min(max(int(n_components), 1), nbcolumns - 1)
    return n_components
