I am getting this error while plotting pairplot using seaborn library in Python. With reference to the previous questions asked on the same topic, I cleaned my data and verified if I have any null value,
train_data.isnull().values.any()
Out[91]: False
import seaborn as sns
sns.pairplot(train_data)
I am still getting this Value Error for a seaborn plot. I am not sure apart from cleaning data, what else we can do to avoid this error. Adding more information about the data, I have total 81 columns and around half a million rows. I dropped a row having all null values and not remaining data is null free. Now question is how to proceed with this error. Any suggestions?
Your dataframe might have NaN values. Remove those rows or replace NaN with 0 and it should work.
I received the same error. I would suggest you to work on several things. First, check if you have string
data type and either convert it to float
or not add for pairplot
, slice up your dataset and then work in it. I actually mean, dimensional reduction
. 81 columns may not be the best choice to experiment. As you mentioned you have half a million rows and 81 columns. First try on smaller dataset and then go for larger one. Seaborn plot sometimes fails to accommodate so many rows and columns on local systems. If you try on some cluster with larger RAM, it might work fine but this error is not new. Try working on
exp = test_data[0:10][:1000]
sns.pairplot(exp)
Before applying this, first remove all string columns and experiment only on float
, int
value columns. I hope this helps.
You need removed all NaN values in oririn DataFrame. Use method df.dropna()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With