Github user zero323 commented on a diff in the pull request:
https://github.com/apache/spark/pull/16792#discussion_r99470847
--- 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
+ replacements are not supported.
- :param to_replace: int, long, float, string, or list.
+ :param to_replace: int, long, float, string, list or dict.
Value to be replaced.
If the value is a dict, then `value` is ignored and
`to_replace` must be a
- mapping from column name (string) to replacement value. The
value to be
- replaced must be an int, long, float, or string.
+ mapping between a value and a replacement.
:param value: int, long, float, string, or list.
- Value to use to replace holes.
The replacement value must be an int, long, float, or string.
If `value` is a
- list or tuple, `value` should be of the same length with
`to_replace`.
+ list, `value` should be of the same length and type as
`to_replace`.
+ If `value` is a scalar and `to_replace` is a sequence, then
`value` is replicated
--- End diff --
Much better :)
---
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]