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

Computed columns within groupby may appear shuffled #1578

Closed
st-pasha opened this issue Jan 22, 2019 · 0 comments · Fixed by #1580
Closed

Computed columns within groupby may appear shuffled #1578

st-pasha opened this issue Jan 22, 2019 · 0 comments · Fixed by #1580
Assignees
Labels
bug Any bugs / errors in datatable; however for severe bugs use [segfault] label groupby Group-by functionality and Reducers
Milestone

Comments

@st-pasha
Copy link
Contributor

>>> from datatable import *
>>> DT = Frame(A=[1, 2, 1, 3, 2, 2, 2, 1, 3, 1], B=range(10))
>>> # This is correct
>>> DT[:, [f.A + f.B], by(f.A)]
      A  C0
---  --  --
 0    1   1
 1    1   3
 2    1   8
 3    1  10
 4    2   3
 5    2   6
 6    2   7
 7    2   8
 8    3   6
 9    3  11

[10 rows x 2 columns]

>>> # This is correct too
>>> DT[:, [f.A + f.B, f.B], by(f.A)]
      A  C0  C1
---  --  --  --
 0    1   1   0
 1    1   3   2
 2    1   8   7
 3    1  10   9
 4    2   3   1
 5    2   6   4
 6    2   7   5
 7    2   8   6
 8    3   6   3
 9    3  11   8

[10 rows x 3 columns]

>>> # But this isn't
>>> DT[:, [f.B, f.A + f.B], by(f.A)]
      A  C0  C1
---  --  --  --
 0    1   0   1
 1    1   2   8
 2    1   7   8
 3    1   9  11
 4    2   1   3
 5    2   4   3
 6    2   5   6
 7    2   6   7
 8    3   3  10
 9    3   8   6

[10 rows x 3 columns]
@st-pasha st-pasha added bug Any bugs / errors in datatable; however for severe bugs use [segfault] label groupby Group-by functionality and Reducers labels Jan 22, 2019
@st-pasha st-pasha added this to the Release 0.8.0 milestone Jan 22, 2019
@st-pasha st-pasha self-assigned this Jan 22, 2019
st-pasha added a commit that referenced this issue Jan 22, 2019
The products of rowindexes were memoized incorrectly, this is now fixed.
In addition, implemented a TODO note in `expr_column` class, which now uses rowindex product memoization too.

Closes #1578
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Any bugs / errors in datatable; however for severe bugs use [segfault] label groupby Group-by functionality and Reducers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant