amueller / introduction_to_ml_with_python

Notebooks and code for the book "Introduction to Machine Learning with Python"
7.44k stars 4.56k forks source link

OptionError: Pattern matched multiple keys on preamble import #157

Closed rschiffer closed 2 years ago

rschiffer commented 2 years ago

Hey there!

I get an Error (OptionError: Pattern matched multiple keys) when executing from preamble import *

I think this is an Error coming from pandas. Detailed traceback:

---> 22 pd.set_option('precision', 2)
     24 __all__ = ['np', 'mglearn', 'display', 'plt', 'pd']

File ~\.conda\envs\machine_learning\lib\site-packages\pandas\_config\config.py:256, in CallableDynamicDoc.__call__(self, *args, **kwds)
    255 def __call__(self, *args, **kwds):
--> 256     return self.__func__(*args, **kwds)

File ~\.conda\envs\machine_learning\lib\site-packages\pandas\_config\config.py:149, in _set_option(*args, **kwargs)
    146     raise TypeError(f'_set_option() got an unexpected keyword argument "{kwarg}"')
    148 for k, v in zip(args[::2], args[1::2]):
--> 149     key = _get_single_key(k, silent)
    151     o = _get_registered_option(key)
    152     if o and o.validator:

File ~\.conda\envs\machine_learning\lib\site-packages\pandas\_config\config.py:116, in _get_single_key(pat, silent)
    114     raise OptionError(f"No such keys(s): {repr(pat)}")
    115 if len(keys) > 1:
--> 116     raise OptionError("Pattern matched multiple keys")
    117 key = keys[0]
    119 if not silent:

OptionError: Pattern matched multiple keys

I'm using the following versions:

Python version: 3.10.4 | packaged by conda-forge | (main, Mar 24 2022, 17:34:17) [MSC v.1929 64 bit (AMD64)]
pandas version: 1.4.1
matplotlib version: 3.5.1
NumPy version: 1.22.3
SciPy version: 1.8.0
IPython version: 8.2.0
scikit-learn version: 1.0.2

Any suggestions?

All the best! Roman

wanghedy commented 2 years ago

您的邮件已收到,我将会尽快处理,谢谢。王宇凝

rschiffer commented 2 years ago

Fixed the issue by applying a small change in preamble.py pd.set_option('precision', 2) => pd.set_option('display.precision', 2)