Skip to content

Conversation

@itholic
Copy link
Contributor

@itholic itholic commented Oct 14, 2019

Like pandas Series.update (https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Series.update.html#pandas.Series.update)

implemented function update for series.

>>> s = ks.Series([1, 2, 3])
>>> s.update(ks.Series([4, 5, 6]))
>>> s
0    4
1    5
2    6
Name: 0, dtype: int64

>>> s = ks.Series(['a', 'b', 'c'])
>>> s.update(ks.Series(['d', 'e'], index=[0, 2]))
>>> s
0    d
1    b
2    e
Name: 0, dtype: object

>>> s = ks.Series([1, 2, 3])
>>> s.update(ks.Series([4, 5, 6, 7, 8]))
>>> s
0    4
1    5
2    6
Name: 0, dtype: int64

>>> s = ks.Series([1, 2, 3])
>>> s.update(ks.Series([4, np.nan, 6]))
>>> s
0    4.0
1    2.0
2    6.0
Name: 0, dtype: float64

@codecov-io
Copy link

codecov-io commented Oct 14, 2019

Codecov Report

Merging #923 into master will decrease coverage by 0.06%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #923      +/-   ##
==========================================
- Coverage   94.83%   94.76%   -0.07%     
==========================================
  Files          34       34              
  Lines        6640     6652      +12     
==========================================
+ Hits         6297     6304       +7     
- Misses        343      348       +5
Impacted Files Coverage Δ
databricks/koalas/missing/series.py 100% <ø> (ø) ⬆️
databricks/koalas/series.py 96.4% <100%> (+0.06%) ⬆️
databricks/conftest.py 95.74% <0%> (-2.13%) ⬇️
databricks/koalas/__init__.py 85.1% <0%> (-2.13%) ⬇️
databricks/koalas/generic.py 95.26% <0%> (-0.48%) ⬇️
databricks/koalas/groupby.py 91.18% <0%> (-0.21%) ⬇️
databricks/koalas/frame.py 96.19% <0%> (-0.07%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e596a58...2e219e0. Read the comment docs.

@itholic
Copy link
Contributor Author

itholic commented Oct 17, 2019

@ueshin Thanks! fixed related with column_index

@itholic
Copy link
Contributor Author

itholic commented Oct 20, 2019

@ueshin Thanks for reviewing!! resolved to use column names properly

raise ValueError("'other' must be a Series")

index_scol_names = [index_map[0] for index_map in self._internal.index_map]
combined = combine_frames(self.to_frame(), other.to_frame(), how='leftouter')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can:

kdf = self.to_frame()
kdf[other_column_name] = other
that_column = scol_for(kdf, other.name)
this_column = scol_for(kdf, self.name)

cond = F.when(
    that_column.isNotNull(), that_column
).otherwise(this_column).alias(...)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@HyukjinKwon Thanks for reviewing! what if other.name and self.name are same?? i think maybe kdf[other_column_name] = other will overwrite existing column, wouldn't it??

@HyukjinKwon
Copy link
Member

@itholic can you rebase this please?

@itholic
Copy link
Contributor Author

itholic commented Nov 6, 2019

@HyukjinKwon yep. i just did :)

@softagram-bot
Copy link

Softagram Impact Report for pull/923 (head commit: 2e219e0)

⭐ Change Overview

Showing the changed files, dependency changes and the impact - click for full size
(Open in Softagram Desktop for full details)

📄 Full report

Impact Report explained. Give feedback on this report to [email protected]

@HyukjinKwon HyukjinKwon merged commit 20f5be6 into databricks:master Nov 7, 2019
@itholic itholic deleted the s_update branch November 8, 2019 04:53
rising-star92 added a commit to rising-star92/databricks-koalas that referenced this pull request Jan 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants