mirror of
https://github.com/NicolasBohn/NexQuant.git
synced 2026-08-07 03:57:45 +00:00
support multiple types in feature engineering (#562)
This commit is contained in:
@@ -57,11 +57,11 @@ if isinstance(X, pd.DataFrame) and isinstance(X_test, pd.DataFrame):
|
||||
assert get_column_list(X) == get_column_list(X_test), "Mismatch in column names of training and test data."
|
||||
|
||||
if isinstance(X, pd.DataFrame):
|
||||
X_dtypes_unique_sorted = sorted(X.dtypes.unique().tolist())
|
||||
X_loaded_dtypes_unique_sorted = sorted(X_loaded.dtypes.unique().tolist())
|
||||
X_dtypes_unique_sorted = sorted([str(dt) for dt in X.dtypes.unique()])
|
||||
X_loaded_dtypes_unique_sorted = sorted([str(dt) for dt in X_loaded.dtypes.unique()])
|
||||
assert (
|
||||
len(X_loaded_dtypes_unique_sorted) == 1
|
||||
and (X_loaded_dtypes_unique_sorted[0] == np.float64 or X_loaded_dtypes_unique_sorted[0] == np.float32)
|
||||
and X_loaded_dtypes_unique_sorted[0] in {np.float64, np.float32}
|
||||
) or (
|
||||
X_dtypes_unique_sorted == X_loaded_dtypes_unique_sorted
|
||||
), f"feature engineering has produced new data types which is not allowed, data loader data types are {X_loaded_dtypes_unique_sorted} and feature engineering data types are {X_dtypes_unique_sorted}"
|
||||
|
||||
Reference in New Issue
Block a user