Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OptionError: Pattern matched multiple keys on preamble import #157

Closed
rschiffer opened this issue Mar 30, 2022 · 2 comments
Closed

OptionError: Pattern matched multiple keys on preamble import #157

rschiffer opened this issue Mar 30, 2022 · 2 comments

Comments

@rschiffer
Copy link
Contributor

rschiffer commented Mar 30, 2022

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
Copy link

wanghedy commented Mar 30, 2022 via email

@rschiffer
Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants