How to deal with TypeError: ufunc 'isnan' not supported for the input types I have dealt with all the Nan values in the features dataframe, then why I am still getting this error? 




sns.heatmap(features, annot=True, annot_kws={"size": 7})
sns.plt.show()




TypeError                                 Traceback (most recent call last)
    &lt;ipython-input-11-534a699b432d&gt; in &lt;module&gt;()
    ----&gt; 1 sns.heatmap(features, annot=True, annot_kws={"size": 7})
          2 sns.plt.show()

    c:\users\jetjo\appdata\local\programs\python\python36\lib\site-packages\seaborn\matrix.py in heatmap(data, vmin, vmax, cmap, center, robust, annot, fmt, annot_kws, linewidths, linecolor, cbar, cbar_kws, cbar_ax, square, xticklabels, yticklabels, mask, ax, **kwargs)
        515     plotter = _HeatMapper(data, vmin, vmax, cmap, center, robust, annot, fmt,
        516                           annot_kws, cbar, cbar_kws, xticklabels,
    --&gt; 517                           yticklabels, mask)
        518 
        519     # Add the pcolormesh kwargs here

    c:\users\jetjo\appdata\local\programs\python\python36\lib\site-packages\seaborn\matrix.py in __init__(self, data, vmin, vmax, cmap, center, robust, annot, fmt, annot_kws, cbar, cbar_kws, xticklabels, yticklabels, mask)
        166         # Determine good default values for the colormapping
        167         self._determine_cmap_params(plot_data, vmin, vmax,
    --&gt; 168                                     cmap, center, robust)
        169 
        170         # Sort out the annotations

    c:\users\jetjo\appdata\local\programs\python\python36\lib\site-packages\seaborn\matrix.py in _determine_cmap_params(self, plot_data, vmin, vmax, cmap, center, robust)
        203                                cmap, center, robust):
        204         """Use some heuristics to set good defaults for colorbar and range."""
    --&gt; 205         calc_data = plot_data.data[~np.isnan(plot_data.data)]
        206         if vmin is None:
        207             vmin = np.percentile(calc_data, 2) if robust else calc_data.min()

    TypeError: ufunc 'isnan' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''
There may be column of type object in your dataFrame. Remove it or convert it into float,int etc. if possible

From Documentation of Seaborn: 

data : rectangular dataset

2D dataset that can be coerced into an ndarray. If a Pandas DataFrame is provided, the index/column information will be used to label the columns and rows.

so you can try

sns.heatmap(features.drop(['columnName01_OfTypeObject','columnName02_OfTypeObject'],axis=1), annot=True, annot_kws={"size": 7})


This will drop your columns temporarily.