Flexible and powerful data analysis / manipulation library for Python, providing labeled data structures similar to R data.frame objects, statistical functions, and much more
import pandas as pd
hasattr(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()