smogn icon indicating copy to clipboard operation
smogn copied to clipboard

IndexError: positional indexers are out-of-bounds

Open bharatkrishna opened this issue 3 years ago • 1 comments

I am running this with data as shown in example. And I get IndexError: positional indexers are out-of-bounds.

data.shape
(1000, 15)

rg_mtrx = [

    [35000,  1, 0],  ## over-sample ("minority")
    [125000, 0, 0],  ## under-sample ("majority")
    [200000, 0, 0],  ## under-sample
    [250000, 0, 0],  ## under-sample
]

gal_data_smogn = smogn.smoter(
    
    ## main arguments
    data = X_sample,           ## pandas dataframe
    y = 'y_val',          ## string ('header name')
    k = 7,                    ## positive integer (k < n)
    pert = 0.04,              ## real number (0 < R < 1)
    samp_method = 'balance',  ## string ('balance' or 'extreme')
    drop_na_col = True,       ## boolean (True or False)
    drop_na_row = True,       ## boolean (True or False)
    replace = False,          ## boolean (True or False)

    ## phi relevance arguments
    rel_thres = 0.10,         ## real number (0 < R < 1)
    rel_method = 'manual',    ## string ('auto' or 'manual')
    # rel_xtrm_type = 'both', ## unused (rel_method = 'manual')
    # rel_coef = 1.50,        ## unused (rel_method = 'manual')
    rel_ctrl_pts_rg = rg_mtrx ## 2d array (format: [x, y])
)

When I run this I get the IndexError.

bharatkrishna avatar Jun 10 '21 22:06 bharatkrishna

Duplicate of #10, use reset_index() as a quick fix.

bentsherman avatar Aug 19 '21 21:08 bentsherman