Github user zero323 commented on a diff in the pull request:
https://github.com/apache/spark/pull/16792#discussion_r99473000
--- Diff: python/pyspark/sql/dataframe.py ---
@@ -1272,16 +1272,18 @@ def replace(self, to_replace, value, subset=None):
"""Returns a new :class:`DataFrame` replacing a value with another
value.
:func:`DataFrame.replace` and :func:`DataFrameNaFunctions.replace`
are
aliases of each other.
+ Values `to_replace` and `value` should be homogeneous. Mixed
string and numeric
--- End diff --
Oh, you mean when we use higher precision type with lower precision column.
Not really an issue with `replace`, don't you think? Maybe something like
_`value` will be truncated when used with lower precision column_? I doubt we
can make it precise and comprehensible at the same time and the main goal
should be to signal possible issues while keeping things relatively clear.
After all there are four different signatures to cover here.
I've missed boolean case. I keep forgetting that `True` is instance of
`int`. Added to the other PR, with tests for mixed numeric types.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]