solo-spice / sospice

Python data analysis tools for the SPICE extreme-UV spectrometer on Solar Orbiter
BSD 3-Clause "New" or "Revised" License
12 stars 5 forks source link

Catalog should not be a dataclass #42

Open ebuchlin opened 7 months ago

ebuchlin commented 7 months ago

The Catalog class derives from a pandas.DataFrame, and is also a dataclass. This seems to work, but on a simple example such as

from dataclasses import dataclass
import pandas as pd

@dataclass
class Test(pd.DataFrame):
    other: int

# how to instantiate this class with no error?
Test(pd.DataFrame(), 2)

it doesn't. It seems that dataclasses can only derive from other dataclasses. So Catalog should be transformed to a regular class.

ebuchlin commented 7 months ago

Subclassing pandas objects has in fact to be done in a specific way.