I have a pandas DataFrame with multiple columns filled with numbers and rows, and the 1st column has the categorical data. Obviously, I have NaN values and zeroes in multiple rows (but not the entire blank row, of course) and in different columns.
The rows have valuable data in other columns which are not NaN. And the columns have valuable data in other rows, which are also not NaN.
The problem is that sns.pairplot
does not ignore NaN values for correlation and returns errors (such as division by zero, string to float conversion, etc.).
I have seen some people saying to use fillna()
method, but I am hoping if anyone knows a more elegant way to do this, without having to go through that solution and spend numerous hours to fix the plot, axis, filters, etc. afterwards. I didn't like that work around.
It is similar to what this person has reported:
https://github.com/mwaskom/seaborn/issues/1699
ZeroDivisionError: 0.0 cannot be raised to a negative power