def conv_pd_index(target) -> pd.Index: check_type(target, [ list, tuple, pd.Series, np.ndarray, pd.Index, pd.RangeIndex, pd.MultiIndex ]) if type(target) == list or type(target) == tuple or type( target) == pd.Series or type(target) == np.ndarray: return pd.Index(target) else: # np.ndarrayのみを想定 return target
def conv_ndarray(target) -> np.ndarray: check_type(target, [ list, tuple, pd.DataFrame, pd.Index, pd.Series, np.ndarray, pd.RangeIndex, pd.MultiIndex ]) if type(target) == list or type(target) == tuple: return np.array(target) elif type(target) == pd.DataFrame or type(target) == pd.Index or type( target) == pd.Series or type(target) == pd.RangeIndex or type( target) == pd.MultiIndex: return target.values else: # np.ndarrayのみを想定 return target
def set_sql(self, sql: List[str]): self.logger.debug("START") check_type(sql, [str, list]) if type(sql) == str: x = sql if strfind(r"^select", x, flags=re.IGNORECASE): self.raise_error(self.__display_sql(x) + ". you can't set 'SELECT' sql.") else: self.sql_list.append(x) elif type(sql) == list: for x in sql: if strfind(r"^select", x, flags=re.IGNORECASE): self.raise_error(self.__display_sql(x) + ". you can't set 'SELECT' sql.") else: self.sql_list.append(x) self.logger.debug("END")
def default_proc(self, colname_explain: np.ndarray, colname_answer: np.ndarray): logger.info("START") check_type(colname_explain, [np.ndarray]) check_type(colname_answer, [np.ndarray]) self.processing["default_x"] = {} self.processing["default_x"]["type"] = "x" self.processing["default_x"]["cols"] = colname_explain self.processing["default_x"]["proc"] = [] self.processing["default_y"] = {} self.processing["default_y"]["type"] = "y" self.processing["default_y"]["cols"] = colname_answer self.processing["default_y"]["proc"] = [] self.processing["default_row"] = {} self.processing["default_row"]["type"] = "row" self.processing["default_row"]["cols"] = None self.processing["default_row"]["proc"] = [] logger.info("END")
def __init__(self, target_indexes: List[int]=None): check_type(target_indexes, [list, tuple, type(None)]) self.target_indexes = target_indexes self.dict_conv = {}
def __init__(self, target_indexes: List[int]): check_type(target_indexes, [list, tuple]) self.target_indexes = target_indexes
def __init__(self, target_indexes: List[int]): check_type(target_indexes, [list, tuple]) self.target_indexes = target_indexes self.model = OneHotEncoder(categories='auto')