// don"t make a deepcopy of data!
if key == "data":
result.__dict__[key] = self.__dict__[key]
continue
result.__dict__[key] = deepcopy(self.__dict__[key], memo)
return result
@classmethod
After Change
Deep copy without copying the self.data dataframe
cls = self.__class__
result = cls.__new__(cls)memo[id(self)] = result
for key, item in self.__dict__.items():
if key == "_cache":
result.__dict__[key] = self.__dict__[key]