Article From:https://segmentfault.com/q/1010000012149515
Question:

I wrote a function to calculate the number of unique values of each column in the data frame.

def unqiue_element(x):
    a=len(np.unqiue(x))
    return a
print "the number of unique items in each column",train.apply(unqiue_element)

Error
AttributeError: (“‘module’ object has no attribute ‘unqiue'”, u’occurred at index PatientId’)
Don’t know how to solve it? What’s the problem with my writing?

Answer 0:

unqiue。。。Spelling is wrong? Unique

Leave a Reply

Your email address will not be published. Required fields are marked *