'set attribute to a class variable in dataclasses with __post_init__

I have a class like

@dataclass_json(letter_case=LetterCase.CAMEL)
@dataclass
class GraphProcessor:
    entities: ClassVar[DataFrame] = field(init=False)
    relations: ClassVar[DataFrame] = field(init=False)

    def __post_init__(self):
        
        # Initialize Entities
        self.entities = to_df(g.V().has("prop").valueMap(True))

ERROR: AttributeError: can't set attribute

I even tried

GraphProcessor.__setattr__(self, **{"entities": entities, "relations": DataFrame()})


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source