Skip to content

Conversation

@itholic
Copy link
Contributor

@itholic itholic commented Oct 15, 2019

Resolve #931 (The contents below is same as the contents of this issue)

When we use is_monotonic_decreasing or is_monotonic_increasing for index,

pandas works like below:

>>> s = pd.Series([7, 6, 5, 4, 3, 2, 1], index=[7, 6, 5, 4, 3, 2, 1])
>>> s.index.is_monotonic_decreasing
True

Since the index order is literally motononic decreasing, they return True

But our case,

>>> s = ks.Series([7, 6, 5, 4, 3, 2, 1], index=[7, 6, 5, 4, 3, 2, 1])
>>> s.index.is_monotonic_decreasing
False

as seen above, it returns False.

because our existing logic always order by index column before calculate the each rows increasing or decreasing.

So they always calculate result based on data column, not index column. (index column is always sorted since order by)

So i think maybe it is better to fix this logic to follow behavior of pandas one for index.

@ueshin
Copy link
Collaborator

ueshin commented Oct 15, 2019

@itholic Good catch!
btw, the proposed fix seems still something missing:

>>> pser
0.097069    0.097069
0.674804    0.674804
0.417065    0.417065
dtype: float64
>>> pser.is_monotonic
False
>>> pser.index.is_monotonic
False

>>> ks.from_pandas(pser).is_monotonic
True
>>> ks.from_pandas(pser).index.is_monotonic
False

maybe we need to apply the fix for Index to Series' case as well.

@codecov-io
Copy link

codecov-io commented Oct 15, 2019

Codecov Report

Merging #930 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #930      +/-   ##
==========================================
+ Coverage   94.46%   94.47%   +<.01%     
==========================================
  Files          34       34              
  Lines        6382     6393      +11     
==========================================
+ Hits         6029     6040      +11     
  Misses        353      353
Impacted Files Coverage Δ
databricks/koalas/base.py 94.83% <100%> (+0.03%) ⬆️
databricks/koalas/missing/frame.py 100% <0%> (ø) ⬆️
databricks/koalas/missing/indexes.py 100% <0%> (ø) ⬆️
databricks/koalas/missing/series.py 100% <0%> (ø) ⬆️
databricks/koalas/frame.py 96.02% <0%> (ø) ⬆️
databricks/koalas/series.py 95.6% <0%> (+0.01%) ⬆️
databricks/koalas/indexes.py 97.38% <0%> (+0.18%) ⬆️

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 465861c...af68952. Read the comment docs.

@itholic
Copy link
Contributor Author

itholic commented Oct 15, 2019

@ueshin , ah i missed it. just fixed it, Thanks for commenting :)

@ueshin
Copy link
Collaborator

ueshin commented Oct 15, 2019

Let me retrigger the build and let's see.

@itholic
Copy link
Contributor Author

itholic commented Oct 15, 2019

@ueshin oops my comment removed by mistake; yeah let's see and maybe hyukjin is something doing for speed up build process. 😃

Copy link
Member

@HyukjinKwon HyukjinKwon left a comment

Choose a reason for hiding this comment

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

LGTM otherwise

@softagram-bot
Copy link

Softagram Impact Report for pull/930 (head commit: af68952)

⭐ 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 f91b73c into databricks:master Oct 22, 2019
@itholic itholic deleted the index_is_monotonic branch October 23, 2019 04: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.

is_monotonic_decreasing & is_monotonic_increasing for index not work properly

5 participants