data = { 
        'node1': [2,2,2,3,3,5,5],
        'node2': [8,16,22,5,25,10,77],
        'weight': [1,1,1,1,1,1,1], }
df = pd.DataFrame(data, columns = ['node1','node2','weight'])
print df["node1"].value_counts()
This gives the output as :
2 3
3 2
5 2
But I desire the answer 3 as that is the number of unique values of rows in column node1
 
    