bucketplot.py
def divide_n(df, bucket_var, n_bins=10):
    """
    Assign each row of `df` to a bucket by dividing the range of the 
    `bucket_var` column into `n_bins` number of equal width intervals.
    
    df: DataFrame
    bucket_var: Name of the column of df to use for dividing.
    n_bins: positive integer number of buckets.
    
    Returns: df with the additional `bucket` column 
        The `bucket` column is Categorical data type consisting of Intervals
        that partition the interval from just below min(bucket_var) to 
        max(bucket_var).
    """
    df_w_buckets = df.assign(
        bucket=lambda df: pd.cut(df[bucket_var], bins=n_bins)
    )
    return(df_w_buckets)

    Assign each row of `df` to a bucket by dividing the range of the 
    `bucket_var` column into `n_bins` number of equal width intervals.
    
    df: DataFrame
    bucket_var: Name of the column of df to use for dividing.
    n_bins: positive integer number of buckets.
    
    Returns: df with the additional `bucket` column 
        The `bucket` column is Categorical data type consisting of Intervals
        that partition the interval from just below min(bucket_var) to 
        max(bucket_var).
    


DataFrame
bucket_var: Name of the column of df to use for dividing.
n_bins: positive integer number of buckets.

df with the additional `bucket` column
The `bucket` column is Categorical data type consisting of Intervals
that partition the interval from just below min(bucket_var) to
max(bucket_var).
DataFrame bucket_var : Name of the column of df to use for dividing . n_bins : positive integer number of buckets . df with the additional ` bucket ` column The ` bucket ` column is Categorical data type consisting of Intervals that partition the interval from just below min ( bucket_var ) to max ( bucket_var ) .
def divide_n(df, bucket_var, n_bins=10):
    df_w_buckets = df.assign(
        bucket=lambda df: pd.cut(df[bucket_var], bins=n_bins)
    )
    return(df_w_buckets)
def divide_n ( df , bucket_var , n_bins = 10 ) : df_w_buckets = df . assign ( bucket = lambda df : pd . cut ( df [ bucket_var ] , bins = n_bins ) ) return ( df_w_buckets )
Assign each row of `df` to a bucket by dividing the range of the
`bucket_var` column into `n_bins` number of equal width intervals.
Assign each row of ` df ` to a bucket by dividing the range of the ` bucket_var ` column into ` n_bins ` number of equal width intervals .
"""
    Assign each row of `df` to a bucket by dividing the range of the 
    `bucket_var` column into `n_bins` number of equal width intervals.
    
    df: DataFrame
    bucket_var: Name of the column of df to use for dividing.
    n_bins: positive integer number of buckets.
    
    Returns: df with the additional `bucket` column 
        The `bucket` column is Categorical data type consisting of Intervals
        that partition the interval from just below min(bucket_var) to 
        max(bucket_var).
    """
df
bucket_var
n_bins