Skip to content

Conversation

@itholic
Copy link
Contributor

@itholic itholic commented Mar 25, 2020

This PR proposes Series.asof()
(https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Series.asof.html#pandas.Series.asof)

>>> s = ks.Series([1, 2, np.nan, 4], index=[10, 20, 30, 40])
>>> s
10    1.0
20    2.0
30    NaN
40    4.0
Name: 0, dtype: float64

A scalar where.

>>> s.asof(20)
2.0

For a sequence where, a Series is returned. The first value is
NaN, because the first element of where is before the first
index value.

>>> s.asof([5, 20]).sort_index()
5     NaN
20    2.0
Name: 0, dtype: float64

Missing values are not considered. The following is 2.0, not
NaN, even though NaN is at the index location for 30.

>>> s.asof(30)
2.0

@codecov-io
Copy link

codecov-io commented Mar 30, 2020

Codecov Report

Merging #1366 into master will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1366      +/-   ##
==========================================
+ Coverage   95.17%   95.19%   +0.01%     
==========================================
  Files          34       34              
  Lines        7878     7902      +24     
==========================================
+ Hits         7498     7522      +24     
  Misses        380      380              
Impacted Files Coverage Δ
databricks/koalas/missing/series.py 100.00% <ø> (ø)
databricks/koalas/series.py 96.96% <100.00%> (+0.09%) ⬆️

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 67d9dc0...4cddee5. Read the comment docs.

@HyukjinKwon
Copy link
Member

Seems fine. Can you rebase @itholic?

@HyukjinKwon HyukjinKwon merged commit abee019 into databricks:master Apr 7, 2020
@itholic itholic deleted the s_asof branch April 9, 2020 00:25
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.

3 participants