def add_bins_col_to_rank_df(df_feature,
                            n_bins,
                            bin_no_col='bin_no',
                            item_rank_col='equity_rank',
                            max_rank_col='max_rank'
                            ):
    """
    Description: This function takes as input a dataframe with ranks,
                 and creates a column with the respective bin number computed from the rank.

    :param df_feature:Type pandas dataframe. feature and period level dataframe with rank values.
    :param n_bins:Type int. number of bins to split the equities into.
    :param bin_no_col:Type str. bin number column name.
    :param item_rank_col:Type str. individual item rank column name.
    :param max_rank_col:Type str. maximum possible rank column name.
    :return:Type pandas dataframe. feature and period level dataframe with bin assignments.
    """

    df_feature[bin_no_col] = 1 + (n_bins * (df_feature[item_rank_col] - 1) // df_feature[max_rank_col])

    return df_feature