|
28 | 28 | from skrub._to_float import ToFloat |
29 | 29 | from skrub._to_str import ToStr |
30 | 30 | from skrub.conftest import _POLARS_INSTALLED |
31 | | -from skrub.datasets._generating import toy_cities |
32 | 31 |
|
33 | 32 | MSG_PANDAS_DEPRECATED_WARNING = "Skip deprecation warning" |
34 | 33 |
|
@@ -1281,26 +1280,38 @@ def test_duration_to_float(df_module): |
1281 | 1280 |
|
1282 | 1281 |
|
1283 | 1282 | def test_list_transformations(df_module): |
1284 | | - df = toy_cities() |
| 1283 | + df = df_module.make_dataframe( |
| 1284 | + { |
| 1285 | + "numbers": [1, 2, 3, 4, 5, 6, None], |
| 1286 | + "low_card": ["up", "up", "up", "down", "down", "up", "down"], |
| 1287 | + "datetime": [ |
| 1288 | + "2026-06-01", |
| 1289 | + "2026-06-04", |
| 1290 | + "2026-07-03", |
| 1291 | + "2026-05-29", |
| 1292 | + "2026-01-08", |
| 1293 | + "2026-06-20", |
| 1294 | + None, |
| 1295 | + ], |
| 1296 | + } |
| 1297 | + ) |
1285 | 1298 |
|
1286 | 1299 | vectorizer = TableVectorizer() |
1287 | 1300 | _ = vectorizer.fit_transform(df) |
1288 | 1301 | vectorizer_output = vectorizer.list_transformations() |
1289 | 1302 | assert vectorizer_output == ( |
1290 | | - "Columns with standardized nulls:\n\tuid\n\tcities\nColumns " |
1291 | | - "transformed to datetime:\n\tstart\n\tend\n\n\nnumeric transformer" |
1292 | | - " is PassThrough and was applied to:\n\tencoded_cities\n\tmetric_0" |
1293 | | - "\n\tmetric_1\n\tmetric_2\n\tmetric_3\ndatetime transformer is " |
1294 | | - "DatetimeEncoder and was applied to:\n\tstart\n\tend\nlow_cardinality" |
1295 | | - " transformer is OneHotEncoder and was applied to:\n\tcities\n" |
1296 | | - "high_cardinality transformer is StringEncoder and was applied " |
1297 | | - "to:\n\tuid\n\n\n" |
| 1303 | + "Columns with standardized nulls:\n\tlow_card\n\tdatetime\nColumns " |
| 1304 | + "transformed to datetime:\n\tdatetime\n\n\nnumeric transformer is " |
| 1305 | + "PassThrough and was applied to:\n\tnumbers\ndatetime transformer " |
| 1306 | + "is DatetimeEncoder and was applied to:\n\tdatetime\nlow_cardinality " |
| 1307 | + "transformer is OneHotEncoder and was applied to:\n\tlow_card\n" |
| 1308 | + "No high_cardinality columns have been detected.\n\n\n" |
1298 | 1309 | ) |
1299 | 1310 |
|
1300 | 1311 | vectorizer = Cleaner() |
1301 | 1312 | _ = vectorizer.fit_transform(df) |
1302 | 1313 | cleaner_output = vectorizer.list_transformations() |
1303 | 1314 | assert ( |
1304 | | - cleaner_output == "Columns with standardized nulls:\n\tuid\n\tcities\nColumns " |
1305 | | - "transformed to datetime:\n\tstart\n\tend\n" |
| 1315 | + cleaner_output == "Columns with standardized nulls:\n\tlow_card\n\t" |
| 1316 | + "datetime\nColumns transformed to datetime:\n\tdatetime\n" |
1306 | 1317 | ) |
0 commit comments