dalejung / pandas-composition

Pandas Composition/Inheritance
MIT License
9 stars 0 forks source link

UserFrame methods that override pd.DataFrame do not get called. #6

Closed dalejung closed 11 years ago

dalejung commented 11 years ago
        # this is to support overridden attrs from subclass.
        # TODO: build up a dict of all base classes before UserFrame/UserSeries
        type_dict = type(self).__dict__
        is_user_class = _is_user_class(self)
        if not is_user_class and name in type_dict:
            return object.__getattribute__(self, name)

This line skips UserFrame. Well, outside of the fact that it won't grab iteritems for subclasses (it only checks for current class).

So for the case of operating on a UserFrame, it will default to skipping it.

Not sure why.

dalejung commented 11 years ago

https://github.com/dalejung/trtools/commit/14dfda86070defef68ba7e540c6ab663d92a53f3#trtools/tools/composition.py

Is where the decision to skip UserFrame methods came in. As per the usually, didn't really document why. Classic Dale.

dalejung commented 11 years ago

Added proper MRO