[
https://issues.apache.org/jira/browse/SPARK-19454?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
holdenk reassigned SPARK-19454:
-------------------------------
Assignee: Maciej Szymkiewicz
> Improve DataFrame.replace API
> -----------------------------
>
> Key: SPARK-19454
> URL: https://issues.apache.org/jira/browse/SPARK-19454
> Project: Spark
> Issue Type: Improvement
> Components: PySpark, SQL
> Affects Versions: 1.5.0, 1.6.0, 2.0.0, 2.1.0, 2.2.0
> Reporter: Maciej Szymkiewicz
> Assignee: Maciej Szymkiewicz
> Fix For: 2.2.0
>
>
> Current implementation suffers from following issues:
> - It is possible to use {{dict}} as {{to_replace}}, but we cannot skip or use
> {{None}} as the value {{value}} (although it is ignored). This requires
> passing "magic" values:
> {code}
> df = sc.parallelize([("Alice", 1, 3.0)]).toDF()
> df.replace({"Alice": "Bob"}, 1)
> {code}
> - Code doesn't check if provided types are correct. This can lead to
> exception in Py4j (harder to diagnose):
> {code}
> df.replace({"Alice": 1}, 1)
> {code}
> or silent failures (with bundled Py4j version):
> {code}
> df.replace({1: 2, 3.0: 4.1, "a": "b"}, 1)
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]