Skip to content

sns.heatmap fails with OptionError: "No such keys(s): 'compute.use_numexpr'" #28551

@thakkardharmik

Description

@thakkardharmik

sns.heatmap fails with OptionError: "No such keys(s): 'compute.use_numexpr'"

OptionError                               Traceback (most recent call last)
<ipython-input-157-342bfcd26ea6> in <module>()
----> 1 plot_confusion_matrix(y_test, predicted_y)

<ipython-input-156-5c1d0cc2db4c> in plot_confusion_matrix(test_y, predict_y)
     35     cmap=sns.light_palette("blue")
     36     plt.subplot(1, 3, 1)
---> 37     sns.heatmap(C)
     38     plt.xlabel('Predicted Class')
     39     plt.ylabel('Original Class')

~/.pyenv/versions/anaconda3-5.2.0/lib/python3.6/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,
--> 517                           yticklabels, mask)
    518 
    519     # Add the pcolormesh kwargs here

~/.pyenv/versions/anaconda3-5.2.0/lib/python3.6/site-packages/seaborn/matrix.py in __init__(self, data, vmin, vmax, cmap, center, robust, annot, fmt, annot_kws, cbar, cbar_kws, xticklabels, yticklabels, mask)
    111 
    112         # Validate the mask and convet to DataFrame
--> 113         mask = _matrix_mask(data, mask)
    114 
    115         plot_data = np.ma.masked_where(np.asarray(mask), plot_data)

~/.pyenv/versions/anaconda3-5.2.0/lib/python3.6/site-packages/seaborn/matrix.py in _matrix_mask(data, mask)
     90     # This works around an issue where `plt.pcolormesh` doesn't represent
     91     # missing data properly
---> 92     mask = mask | pd.isnull(data)
     93 
     94     return mask

~/.pyenv/versions/anaconda3-5.2.0/lib/python3.6/site-packages/pandas/core/ops.py in f(self, other, axis, level, fill_value)

~/.pyenv/versions/anaconda3-5.2.0/lib/python3.6/site-packages/pandas/core/frame.py in _combine_frame(self, other, func, fill_value, level)
   4749 
   4750         Returns
-> 4751         -------
   4752         DataFrame
   4753             DataFrame with NA entries dropped from it.

~/.pyenv/versions/anaconda3-5.2.0/lib/python3.6/site-packages/pandas/core/frame.py in _arith_op(left, right)
   4730             .. deprecated:: 0.23.0
   4731 
-> 4732                Pass tuple or list to drop on multiple axes.
   4733                Only a single axis is allowed.
   4734 

~/.pyenv/versions/anaconda3-5.2.0/lib/python3.6/site-packages/pandas/core/ops.py in na_op(x, y)

~/.pyenv/versions/anaconda3-5.2.0/lib/python3.6/site-packages/pandas/core/computation/expressions.py in <module>()
    166 
    167 # turn myself on
--> 168 set_use_numexpr(get_option("compute.use_numexpr"))
    169 
    170 

~/.pyenv/versions/anaconda3-5.2.0/lib/python3.6/site-packages/pandas/_config/config.py in __call__(self, *args, **kwds)
    231 
    232     def __call__(self, *args, **kwds):
--> 233         return self.__func__(*args, **kwds)
    234 
    235     @property

~/.pyenv/versions/anaconda3-5.2.0/lib/python3.6/site-packages/pandas/_config/config.py in _get_option(pat, silent)
    100 
    101 def _get_option(pat, silent=False):
--> 102     key = _get_single_key(pat, silent)
    103 
    104     # walk the nested dict

~/.pyenv/versions/anaconda3-5.2.0/lib/python3.6/site-packages/pandas/_config/config.py in _get_single_key(pat, silent)
     86         if not silent:
     87             _warn_if_deprecated(pat)
---> 88         raise OptionError("No such keys(s): {pat!r}".format(pat=pat))
     89     if len(keys) > 1:
     90         raise OptionError("Pattern matched multiple keys")

OptionError: "No such keys(s): 'compute.use_numexpr'"

Seaborn and pandas version -
pandas==0.25.1
seaborn==0.9.0
The code I am trying is -

labels = [1,2]
C = confusion_matrix(test_y, predict_y)
#[[9475 9411]
#[5490 5624]]

sns.heatmap(C, annot=True, cmap=cmap, fmt=".3f", xticklabels=labels, yticklabels=labels)
plt.xlabel('Predicted Class')
plt.ylabel('Original Class')
plt.title("Precision matrix")

I have tried reinstalling pandas as suggested here mwaskom/seaborn#1789

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions