I am trying to create a subclass of a Pandas data structure to substitute, in my code, a subclass of a dict with a subclass of a Series, I don't understand why this example code doesn't work
from pandas import Series
class Support(Series):
def supportMethod1(self):
print 'I am support method 1'
def supportMethod2(self):
print 'I am support method 2'
class Compute(object):
supp=None
def test(self):
self.supp()
class Config(object):
supp=None
@classmethod
def initializeConfig(cls):
cls.supp=Support()
@classmethod
def setConfig1(cls):
Compute.supp=cls.supp.supportMethod1
@classmethod
def setConfig2(cls):
Compute.supp=cls.supp.supportMethod2
Config.initializeConfig()
Config.setConfig1()
c1=Compute()
c1.test()
Config.setConfig2()
c1.test()
Probably it is not the best method to change the configuration of some objects, anyway I found this usefull in my code and most of all I want to understand why with dict instead of series it works as I expect.
Thanks a lot!