diff --git a/python/ray/ml/preprocessors/encoder.py b/python/ray/ml/preprocessors/encoder.py
index <HASH>..<HASH> 100644
--- a/python/ray/ml/preprocessors/encoder.py
+++ b/python/ray/ml/preprocessors/encoder.py
@@ -168,7 +168,8 @@ class Categorizer(Preprocessor):
         return df
 
     def __repr__(self):
-        return f"<Categorizer columns={self.columns} stats={self.stats_}>"
+        stats = getattr(self, "stats_", None)
+        return f"<Categorizer columns={self.columns} stats={stats}>"
 
 
 def _get_unique_value_indices(
[AIR] Fix Categorizer.__repr__ attribute error (#<I>)

__repr__ fails because stats_ attribute is not assigned until _fit is called.