kieferk / dfply

dplyr-style piping operations for pandas dataframes
GNU General Public License v3.0
889 stars 103 forks source link

Fix grouping issue for mask function #25

Closed bleearmstrong closed 6 years ago

bleearmstrong commented 7 years ago

This PR is a fix for issue #24 (indexes weren't aligning correctly, so element-wise comparison was returning bad results)

bleearmstrong commented 7 years ago

I should add that this isn't actually a grouping issue, it's an index issue.

test = pd.DataFrame({'a': [1, 2, 3]}, index=['a', 'b', 'c'])
test >> mask(X.a > 0)

Empty DataFrame
Columns: [a]
Index: []

This is fine after the fix.

test = pd.DataFrame({'a': [1, 2, 3]}, index=['a', 'b', 'c'])
test >> mask(X.a > 0)

   a
a  1
b  2
c  3
kieferk commented 6 years ago

This is no longer an issue AFAIK per v0.3.1