Skip to content

ENH/BUG: Sparse now supports comparison op #12971

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

Closed
wants to merge 1 commit into from

Conversation

sinhrks
Copy link
Member

@sinhrks sinhrks commented Apr 23, 2016

  • no open issue
  • tests added / passed
  • passes git diff upstream/master | flake8 --diff
  • whatsnew entry

on current master

pd.SparseArray([1, 2, np.nan]) > 0
# [True, True, nan]
# Fill: nan
# IntIndex
# Indices: array([0, 1], dtype=int32)

# Expected
# [True, True, False]
a = pd.SparseArray([1, 2, 0])
b = pd.SparseArray([0, 1, np.nan])
a > b
# ValueError: operands could not be broadcast together with shapes (3,) (2,) 

@sinhrks sinhrks added Bug Numeric Operations Arithmetic, Comparison, and Logical operations Sparse Sparse Data Type labels Apr 23, 2016
@sinhrks sinhrks added this to the 0.18.1 milestone Apr 23, 2016
sparse_index=self.sp_index,
fill_value=new_fill_value)
if name in ('eq', 'ne', 'lt', 'gt', 'le', 'ge'):
# ToDo: We can remove this condition when removing
Copy link
Contributor

Choose a reason for hiding this comment

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

fine for now, worth encapsulating into a function so easier to refactor later?

@sinhrks
Copy link
Member Author

sinhrks commented Apr 25, 2016

Ok, fixed and now green.

@jreback jreback closed this in 8890cc1 Apr 25, 2016
@jreback
Copy link
Contributor

jreback commented Apr 25, 2016

thank you sir!

@sinhrks sinhrks deleted the sparse_bool_test branch April 25, 2016 22:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Numeric Operations Arithmetic, Comparison, and Logical operations Sparse Sparse Data Type
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants