def nunique(x, dropna = False):
    if istable(x)==True: return x.nunique()
    else:
        u = []; n = 0
        for a in x:
            if dropna == True: 
                if a not in u and a!=np.nan: u.append(a); n += 1
            else: 
                if a not in u: u.append(a); n += 1
        del u,a
        return n