We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
.str.replace
Describe the bug When the replacement value is not a string, there appears to be a data-corruption in .str.replace
Steps/Code to reproduce bug
In [1]: import cudf In [2]: idx = cudf.Index(['a', 'b', 'c']) In [3]: idx.str.replace("a", 3) Out[3]: Index(['', 'b', 'c'], dtype='object') In [4]: idx.to_pandas().str.replace("a", 3) --------------------------------------------------------------------------- TypeError Traceback (most recent call last) Cell In[4], line 1 ----> 1 idx.to_pandas().str.replace("a", 3) File /datasets/pgali/envs/cudfdev/lib/python3.12/site-packages/pandas/core/strings/accessor.py:137, in forbid_nonstring_types.<locals>._forbid_nonstring_types.<locals>.wrapper(self, *args, **kwargs) 132 msg = ( 133 f"Cannot use .str.{func_name} with values of " 134 f"inferred dtype '{self._inferred_dtype}'." 135 ) 136 raise TypeError(msg) --> 137 return func(self, *args, **kwargs) File /datasets/pgali/envs/cudfdev/lib/python3.12/site-packages/pandas/core/strings/accessor.py:1548, in StringMethods.replace(self, pat, repl, n, case, flags, regex) 1546 # Check whether repl is valid (GH 13438, GH 15055) 1547 if not (isinstance(repl, str) or callable(repl)): -> 1548 raise TypeError("repl must be a string or callable") 1550 is_compiled_re = is_re(pat) 1551 if regex or regex is None: TypeError: repl must be a string or callable
The text was updated successfully, but these errors were encountered:
galipremsagar
No branches or pull requests
Describe the bug
When the replacement value is not a string, there appears to be a data-corruption in
.str.replace
Steps/Code to reproduce bug
The text was updated successfully, but these errors were encountered: