Skip to content
Advertisement

Trying to ignore Nan in csv file throws a typeerror

I’m loading a local csv file that contains data. I’m trying to find the smallest float in a row thats mixed of NaN and numbers.
I have tried using the numpy function called np.nanmin, but it throws:

JavaScript
JavaScript

Any suggestions to why nanmin might not work?

A link to the entire csv file: http://www.sharecsv.com/s/5aea6381d1debf75723a45aacd40abf8/database.csv
Here is a sample of my coun_weight:

JavaScript

Advertisement

Answer

I try test it and all problematic values are:

JavaScript

And solution is:

JavaScript

Then if need find minimal values with NaNs – Series.min, where NaNs are skipped:

JavaScript

Testing if some 0 are in column:

JavaScript

Another possible solution is replace this values to NaNs:

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement