mercredi 15 juin 2016

Find max value in a pandas dataframe that also has None's, Python 3.5


I have a pandas dataframe setup like this:

     Group1      Group2      Group3
0   0.04058678  0.04282689  0.06680679
1   0.11657916  0.06695174  0.05153584
2   0.08382576  0.03587087  0.08919266
3   0.17477007  0.08141088  0.10727157
4    0.0821453  0.08226264  0.06800853
5   0.15685707        None  0.09467674
6   0.08237982        None  0.14494069
7         None        None  0.14541177
8         None        None  0.12181681
9         None        None  0.17966472
10        None        None   0.1509818

I tried using df.max() to find the maximum value in the dataframe, but it doesn't work with this data and I think it is because of None in some fields.

I get this error:

print(df.max())  
TypeError: unorderable types: float() > str()

How do I deal with None in this dataframe so that I can get the maximum value?


Aucun commentaire:

Enregistrer un commentaire