Closed beobest2 closed 4 years ago
Seems like that parameter was added to address https://github.com/databricks/koalas/pull/495#issuecomment-505129634 issue. The current DataFrame.replace
seems incomplete.
Can we support dict
and list
in to_replace
? Then I think we can remove it.
I will check if to_replace
support dict
and list
I have checked whether Koalas support dict
and list
in to_replace
It works fine. May I delete subset
parameter?
>>> pdf
A B C
0 0 5 a
1 1 6 b
2 2 7 c
3 3 8 d
4 4 9 e
>>> kdf
A B C
0 0 5 a
1 1 6 b
2 2 7 c
3 3 8 d
4 4 9 e
>>> pdf.replace({'A': 0, 'B': 6}, 100)
A B C
0 100 5 a
1 1 100 b
2 2 7 c
3 3 8 d
4 4 9 e
>>> kdf.replace({'A': 0, 'B': 6}, 100)
A B C
0 100 5 a
1 1 100 b
2 2 7 c
3 3 8 d
4 4 9 e
>>> pdf.replace({0: 100, 1: 1000})
A B C
0 100 5 a
1 1000 6 b
2 2 7 c
3 3 8 d
4 4 9 e
>>> kdf.replace({0: 100, 1: 1000})
A B C
0 100 5 a
1 1000 6 b
2 2 7 c
3 3 8 d
4 4 9 e
>>> pdf.replace([0, 1, 4], 100)
A B C
0 100 5 a
1 100 6 b
2 2 7 c
3 3 8 d
4 100 9 e
>>> kdf.replace([0, 1, 4], 100)
A B C
0 100 5 a
1 100 6 b
2 2 7 c
3 3 8 d
4 100 9 e
Yep, please go ahead
@HyukjinKwon When I tried adding the above test to the test case, I found that pandas does not support the
subset
parameter. So when I looked into the old version, pandas didn't support thesubset
parameter from the beginning. I found that the currentreplace
parameter matches the sparkreplace
. So, what are your thoughts on deleting asubset
from Koalas for pandas?ref>
pandas 0.9.0 DataFrame.replace
pandas 1.0.1 DataFrame.replace
pyspark 2.1.3 DataFrame.replace
_Originally posted by @beobest2 in https://github.com/_render_node/MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDQyNzAxNjQ0Mw==/comments/review_comment_