Repository: modin-project/modin

Issue:
Some `Series.str` signatures don't match pandas



Discussion:

Resolving patch:
diff --git a/modin/core/storage_formats/base/query_compiler.py b/modin/core/storage_formats/base/query_compiler.py
--- a/modin/core/storage_formats/base/query_compiler.py
+++ b/modin/core/storage_formats/base/query_compiler.py
@@ -4499,10 +4499,10 @@ def str_center(self, width, fillchar=" "):
         pat : str
         case : bool, default: True
         flags : int, default: 0
-        na : object, default: np.NaN
+        na : object, default: None
         regex : bool, default: True""",
     )
-    def str_contains(self, pat, case=True, flags=0, na=np.NaN, regex=True):
+    def str_contains(self, pat, case=True, flags=0, na=None, regex=True):
         return StrDefault.register(pandas.Series.str.contains)(
             self, pat, case, flags, na, regex
         )
@@ -4511,19 +4511,18 @@ def str_contains(self, pat, case=True, flags=0, na=np.NaN, regex=True):
         refer_to="count",
         params="""
         pat : str
-        flags : int, default: 0
-        **kwargs : dict""",
+        flags : int, default: 0""",
     )
-    def str_count(self, pat, flags=0, **kwargs):
-        return StrDefault.register(pandas.Series.str.count)(self, pat, flags, **kwargs)
+    def str_count(self, pat, flags=0):
+        return StrDefault.register(pandas.Series.str.count)(self, pat, flags)
 
     @doc_utils.doc_str_method(
         refer_to="endswith",
         params="""
         pat : str
-        na : object, default: np.NaN""",
+        na : object, default: None""",
     )
-    def str_endswith(self, pat, na=np.NaN):
+    def str_endswith(self, pat, na=None):
         return StrDefault.register(pandas.Series.str.endswith)(self, pat, na)
 
     @doc_utils.doc_str_method(
@@ -4540,13 +4539,10 @@ def str_find(self, sub, start=0, end=None):
         refer_to="findall",
         params="""
         pat : str
-        flags : int, default: 0
-        **kwargs : dict""",
+        flags : int, default: 0""",
     )
-    def str_findall(self, pat, flags=0, **kwargs):
-        return StrDefault.register(pandas.Series.str.findall)(
-            self, pat, flags, **kwargs
-        )
+    def str_findall(self, pat, flags=0):
+        return StrDefault.register(pandas.Series.str.findall)(self, pat, flags)
 
     @doc_utils.doc_str_method(
         refer_to="fullmatch",
@@ -4642,9 +4638,9 @@ def str_lstrip(self, to_strip=None):
         pat : str
         case : bool, default: True
         flags : int, default: 0
-        na : object, default: np.NaN""",
+        na : object, default: None""",
     )
-    def str_match(self, pat, case=True, flags=0, na=np.NaN):
+    def str_match(self, pat, case=True, flags=0, na=None):
         return StrDefault.register(pandas.Series.str.match)(self, pat, case, flags, na)
 
     @doc_utils.doc_str_method(
@@ -4702,9 +4698,9 @@ def str_repeat(self, repeats):
         n : int, default: -1
         case : bool, optional
         flags : int, default: 0
-        regex : bool, default: True""",
+        regex : bool, default: None""",
     )
-    def str_replace(self, pat, repl, n=-1, case=None, flags=0, regex=True):
+    def str_replace(self, pat, repl, n=-1, case=None, flags=0, regex=None):
         return StrDefault.register(pandas.Series.str.replace)(
             self, pat, repl, n, case, flags, regex
         )
@@ -4788,18 +4784,21 @@ def str_slice_replace(self, start=None, stop=None, repl=None):
         params="""
         pat : str, optional
         n : int, default: -1
-        expand : bool, default: False""",
+        expand : bool, default: False
+        regex : bool, default: None""",
     )
-    def str_split(self, pat=None, n=-1, expand=False):
-        return StrDefault.register(pandas.Series.str.split)(self, pat, n, expand)
+    def str_split(self, pat=None, n=-1, expand=False, regex=None):
+        return StrDefault.register(pandas.Series.str.split)(
+            self, pat, n=n, expand=expand, regex=regex
+        )
 
     @doc_utils.doc_str_method(
         refer_to="startswith",
         params="""
         pat : str
-        na : object, default: np.NaN""",
+        na : object, default: None""",
     )
-    def str_startswith(self, pat, na=np.NaN):
+    def str_startswith(self, pat, na=None):
         return StrDefault.register(pandas.Series.str.startswith)(self, pat, na)
 
     @doc_utils.doc_str_method(refer_to="strip", params="to_strip : str, optional")
diff --git a/modin/pandas/series_utils.py b/modin/pandas/series_utils.py
--- a/modin/pandas/series_utils.py
+++ b/modin/pandas/series_utils.py
@@ -151,7 +151,7 @@ def _Series(self):  # noqa: GL08
     def casefold(self):
         return self._default_to_pandas(pandas.Series.str.casefold)
 
-    def cat(self, others=None, sep=None, na_rep=None, join=None):
+    def cat(self, others=None, sep=None, na_rep=None, join="left"):
         if isinstance(others, self._Series):
             others = others._to_pandas()
         return self._default_to_pandas(
@@ -163,18 +163,18 @@ def decode(self, encoding, errors="strict"):
             pandas.Series.str.decode, encoding, errors=errors
         )
 
-    def split(self, pat=None, n=-1, expand=False):
+    def split(self, pat=None, n=-1, expand=False, regex=None):
         if not pat and pat is not None:
             raise ValueError("split() requires a non-empty pattern match.")
 
         if expand:
             return self._default_to_pandas(
-                pandas.Series.str.split, pat=pat, n=n, expand=expand
+                pandas.Series.str.split, pat=pat, n=n, expand=expand, regex=regex
             )
         else:
             return self._Series(
                 query_compiler=self._query_compiler.str_split(
-                    pat=pat, n=n, expand=expand
+                    pat=pat, n=n, expand=expand, regex=regex
                 )
             )
 
@@ -204,7 +204,7 @@ def join(self, sep):
     def get_dummies(self, sep="|"):
         return self._default_to_pandas(pandas.Series.str.get_dummies, sep=sep)
 
-    def contains(self, pat, case=True, flags=0, na=np.NaN, regex=True):
+    def contains(self, pat, case=True, flags=0, na=None, regex=True):
         if pat is None and not case:
             raise AttributeError("'NoneType' object has no attribute 'upper'")
         return self._Series(
@@ -213,7 +213,7 @@ def contains(self, pat, case=True, flags=0, na=np.NaN, regex=True):
             )
         )
 
-    def replace(self, pat, repl, n=-1, case=None, flags=0, regex=True):
+    def replace(self, pat, repl, n=-1, case=None, flags=0, regex=None):
         if not (isinstance(repl, str) or callable(repl)):
             raise TypeError("repl must be a string or callable")
         return self._Series(
@@ -278,14 +278,14 @@ def slice_replace(self, start=None, stop=None, repl=None):
             )
         )
 
-    def count(self, pat, flags=0, **kwargs):
+    def count(self, pat, flags=0):
         if not isinstance(pat, (str, _pattern_type)):
             raise TypeError("first argument must be string or compiled pattern")
         return self._Series(
-            query_compiler=self._query_compiler.str_count(pat, flags=flags, **kwargs)
+            query_compiler=self._query_compiler.str_count(pat, flags=flags)
         )
 
-    def startswith(self, pat, na=np.NaN):
+    def startswith(self, pat, na=None):
         return self._Series(
             query_compiler=self._query_compiler.str_startswith(pat, na=na)
         )
@@ -295,16 +295,16 @@ def encode(self, encoding, errors="strict"):
             pandas.Series.str.encode, encoding, errors=errors
         )
 
-    def endswith(self, pat, na=np.NaN):
+    def endswith(self, pat, na=None):
         return self._Series(
             query_compiler=self._query_compiler.str_endswith(pat, na=na)
         )
 
-    def findall(self, pat, flags=0, **kwargs):
+    def findall(self, pat, flags=0):
         if not isinstance(pat, (str, _pattern_type)):
             raise TypeError("first argument must be string or compiled pattern")
         return self._Series(
-            query_compiler=self._query_compiler.str_findall(pat, flags=flags, **kwargs)
+            query_compiler=self._query_compiler.str_findall(pat, flags=flags)
         )
 
     def fullmatch(self, pat, case=True, flags=0, na=None):
@@ -316,11 +316,13 @@ def fullmatch(self, pat, case=True, flags=0, na=None):
             )
         )
 
-    def match(self, pat, case=True, flags=0, na=np.NaN):
+    def match(self, pat, case=True, flags=0, na=None):
         if not isinstance(pat, (str, _pattern_type)):
             raise TypeError("first argument must be string or compiled pattern")
         return self._Series(
-            query_compiler=self._query_compiler.str_match(pat, flags=flags, na=na)
+            query_compiler=self._query_compiler.str_match(
+                pat, case=case, flags=flags, na=na
+            )
         )
 
     def extract(self, pat, flags=0, expand=True):


Test patch: