I have a dataclass that I would like to set a value when initializing the class.
@dataclass
class classA:
__data: DataFrame
__Limit: float
__totalLimit: float = field(init=False)
def __post_init__(self):
# This Does not work
__setTotalLimit()
# This works when i put the logic in.
# self.__totalLimit = self.__data['Amount'].sum()
def __setTotalLimit(self):
self.__totalLimit = self.__data['Amount'].sum()
This is the error I am getting: NameError: name '_classA__setTotalLimit' is not defined
Basically as soon as data is passed in, i need to sum up a column and set that as a variable because it will be used throughout the script.