Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Series.div when div/floordiv np.inf by zero #1463

Merged
merged 10 commits into from
May 18, 2020

Conversation

itholic
Copy link
Contributor

@itholic itholic commented May 6, 2020

There is an incompatible hehaviour with pandas when divide np.inf by 0

>>> pser
0    0.0
1    NaN
2    inf
Name: 0, dtype: float64
>>> kser
0    0.0
1    NaN
2    inf
Name: 0, dtype: float64

>>> pser.div(0)
0    NaN
1    NaN
2    inf
Name: 0, dtype: float64
>>> kser.div(0)
0   NaN
1   NaN
2   NaN  # Have to be a `inf`
Name: 0, dtype: float64

This PR fixed it.

@itholic itholic changed the title Fix Series.div when dividing np.inf by zero Fix Series.div when dividie np.inf by zero May 6, 2020
@itholic itholic changed the title Fix Series.div when dividie np.inf by zero Fix Series.div when divide np.inf by zero May 6, 2020
@codecov-io
Copy link

codecov-io commented May 6, 2020

Codecov Report

Merging #1463 into master will increase coverage by 0.18%.
The diff coverage is 91.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1463      +/-   ##
==========================================
+ Coverage   93.75%   93.93%   +0.18%     
==========================================
  Files          36       36              
  Lines        8386     8445      +59     
==========================================
+ Hits         7862     7933      +71     
+ Misses        524      512      -12     
Impacted Files Coverage Δ
databricks/koalas/missing/groupby.py 100.00% <ø> (ø)
databricks/koalas/mlflow.py 94.87% <ø> (ø)
databricks/koalas/series.py 96.96% <85.71%> (+0.60%) ⬆️
databricks/koalas/generic.py 97.02% <87.50%> (+3.60%) ⬆️
databricks/koalas/groupby.py 90.26% <90.64%> (+0.52%) ⬆️
databricks/koalas/frame.py 95.57% <90.90%> (-0.01%) ⬇️
databricks/koalas/base.py 98.02% <100.00%> (ø)
databricks/koalas/indexing.py 92.16% <100.00%> (+0.02%) ⬆️
databricks/koalas/internal.py 96.37% <100.00%> (+0.02%) ⬆️
databricks/koalas/namespace.py 86.09% <100.00%> (+0.07%) ⬆️
... and 3 more

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 c5977b9...d2a1097. Read the comment docs.

@itholic
Copy link
Contributor Author

itholic commented May 14, 2020

Could someone review this PR when available to finish #1397 ?

@itholic itholic changed the title Fix Series.div when divide np.inf by zero Fix Series.div when divide np.inf by zero and np.nan May 14, 2020
@itholic itholic changed the title Fix Series.div when divide np.inf by zero and np.nan Fix Series.div when div/floordiv np.inf by zero May 14, 2020
@itholic
Copy link
Contributor Author

itholic commented May 14, 2020

@HyukjinKwon
I simplified the existing confused when phrase,
Could you check this once more when you available?
If it's still not enough easy for reading, i'm gonna add an additional description as well.

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.

Looks good otherwise.

@HyukjinKwon HyukjinKwon merged commit 4fe6dc1 into databricks:master May 18, 2020
@itholic itholic deleted the inf_div_zero branch May 29, 2020 00:51
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