Error in using @dataclass with inheritance

74 views Asked by At
@dataclass
class base:
    data_dir: Path = Path(__file__).parents[1] / 'data'
    models_dir: Path = data_dir / 'models'

@dataclass
class field(base):
    id: str
    data_source: str  # can be a csv file or a database
    df: pd.DataFrame  # dataframe containing field information

    def get_field(self):
        pass

In the code above, I get this error: TypeError: non-default argument 'id' follows default argument

How can I fix this?

0

There are 0 answers