Sharkbaitbree
Sharkbaitbree

Reputation: 11

Indexing a Series with DataFrame is not supported, use the appropriate DataFrame column

This is the code I`m am working with. This line dups.drop(dups[h/c > 2.25].index, inplace = True) is the only one not working and I am unsure why. This TypeError I do not understand.

#data is input file
 dat = pd.read_csv(data)
 dat = pd.DataFrame(dat, columns = ['Index', 'm/z' , 'stddev', 'PeakHeight', 'C', 'H', 'N', 'O', 'S', 'P', 'm/z2', 'stddev2'])

    index = dat.iloc[:,0].values
    mz1 = dat.iloc[:,1].values
    stdev1 = dat.iloc[:,2]
    pkht = dat.iloc[:,3]
    c = dat.iloc[:,4]
    h = dat.iloc[:5]
    n = dat.iloc[:,6]
    o = dat.iloc[:,7]
    s = dat.iloc[:,8]
    p = dat.iloc[:,9]
    ch2 = dat.iloc[:,10]
    stdev2 = dat.iloc[:,11]

Upvotes: 0

Views: 6597

Answers (1)

Gabriel
Gabriel

Reputation: 989

You forgot a comma in h = dat.iloc[:5]

Maybe try with h = dat.iloc[:,5]

Upvotes: 1

Related Questions