def __init__(self, df=None, data_name="empty", data_type="standard", column_spec=None): self.df = df self.data_name = data_name self.prior_idx = np.array([], dtype=int) if df is None: self.column_spec = {} return self.max_idx = max(df.index.values) + 1 # Infer column specifications if it is not given. if column_spec is None: self.column_spec = {} for col_name in list(df): data_type = type_from_column(col_name, COLUMN_DEFINITIONS) if data_type is not None: self.column_spec[data_type] = col_name else: self.column_spec = column_spec if "included" not in self.column_spec: self.column_spec["included"] = "included" if data_type == "included": self.labels = np.ones(len(self), dtype=int) if data_type == "excluded": self.labels = np.zeros(len(self), dtype=int) if data_type == "prior": self.prior_idx = df.index.values
def __init__(self, df=None, data_name="empty", data_type="standard", column_spec=None): self.df = df self.data_name = data_name self.prior_idx = [] if df is None: self.column_spec = {} return if data_type == "included": self.labels = np.ones(len(self)) if data_type == "excluded": self.labels = np.zeros(len(self)) if data_type == "prior": self.prior_idx = df.index.values self.max_idx = max(df.index.values) + 1 if column_spec is None: self.column_spec = {} for col_name in list(df): data_type = type_from_column(col_name, COLUMN_DEFINITIONS) if data_type is not None: self.column_spec[data_type] = col_name else: self.column_spec = column_spec if "final_included" not in self.column_spec: self.column_spec["final_included"] = "final_included"