You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importpandasaspdhasattr(pd.options,'bananas') # should return False but instead raises KeyError: 'bananas'getattr(pd.options,'bananas') # should raise AttributeError but ...pd.options.__getattr__('bananas') # should raise AttributeError but ...
Code Sample, a copy-pastable example if possible
Problem description
The docs are clear that custom __getattr__ methods should return a value or raise AttributeError. pandas.options seems to raise KeyError instead. This can be a problem for generic code that iterates through the attributes of any object and expects hasattr() to behave sanely, e.g. https://github.com/Dyalog/pynapl/blob/c6f34d0323aa7370582204c73757f9cea1072794/pynapl/ObjectWrapper.py#L86
Expected Output
Output of
pd.show_versions()
INSTALLED VERSIONS
commit: None
python: 3.6.3.final.0
python-bits: 64
OS: Linux
OS-release: 4.13.0-35-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_GB.UTF-8
LOCALE: en_GB.UTF-8
pandas: 0.22.0
pytest: None
pip: 9.0.1
setuptools: 36.2.7
Cython: None
numpy: 1.14.0
scipy: 0.18.1
pyarrow: None
xarray: None
IPython: 5.1.0
sphinx: None
patsy: None
dateutil: 2.6.1
pytz: 2018.3
blosc: None
bottleneck: None
tables: 3.3.0
numexpr: 2.6.2
feather: None
matplotlib: 2.0.0
openpyxl: None
xlrd: 1.0.0
xlwt: None
xlsxwriter: 0.9.6
lxml: None
bs4: 4.6.0
html5lib: 0.999999999
sqlalchemy: None
pymysql: 0.7.11.None
psycopg2: None
jinja2: 2.9.6
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None
The text was updated successfully, but these errors were encountered: