skrub-data / skrub

Prepping tables for machine learning
https://skrub-data.org/
BSD 3-Clause "New" or "Revised" License
1.22k stars 97 forks source link

MAINT adapt for scikit-learn 1.6 #1135

Open glemaitre opened 1 week ago

glemaitre commented 1 week ago

Adapt the code with changes of related to some changes in the developer API that became public in scikit-learn.

glemaitre commented 1 week ago

The remaining pandas error is:

E               TypeError: Cannot use .astype to convert from timezone-naive dtype to timezone-aware dtype. Use obj.tz_localize instead or series.dt.tz_localize instead

I assume we try to cast.

jeromedockes commented 1 week ago

@glemaitre here is the fix for the time zone failures (pandas changes the representation of time zones in 3.0):

diff --git a/skrub/_to_datetime.py b/skrub/_to_datetime.py
index 4a08013f..a14d3c8a 100644
--- a/skrub/_to_datetime.py
+++ b/skrub/_to_datetime.py
@@ -28,6 +28,8 @@ def _get_time_zone_pandas(col):
         return None
     if hasattr(tz, "zone"):
         return tz.zone
+    if hasattr(tz, "key"):
+        return tz.key
     return tz.tzname(None)