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

dt.prod() calculates sum instead of a product for the grouped columns #3390

Closed
oleksiyskononenko opened this issue Nov 29, 2022 · 2 comments · Fixed by #3396
Closed

dt.prod() calculates sum instead of a product for the grouped columns #3390

oleksiyskononenko opened this issue Nov 29, 2022 · 2 comments · Fixed by #3396
Assignees
Labels
bug Any bugs / errors in datatable; however for severe bugs use [segfault] label
Milestone

Comments

@oleksiyskononenko
Copy link
Contributor

>>> from datatable import dt, f
>>> DT = dt.Frame([1, 1])
>>> DT[:, dt.prod(f.C0)]
   |    C0
   | int64
-- + -----
 0 |     1
[1 row x 1 column]
>>> DT[:, dt.prod(f.C0), by(f.C0)]
   |   C0     C1
   | int8  int64
-- + ----  -----
 0 |    1      2
[1 row x 2 columns]

Note, the product on the grouped column should still be 1, i.e. the correct result for the last example is

   |   C0     C1
   | int8  int64
-- + ----  -----
 0 |    1      1
[1 row x 2 columns]
@oleksiyskononenko oleksiyskononenko added the bug Any bugs / errors in datatable; however for severe bugs use [segfault] label label Nov 29, 2022
@oleksiyskononenko oleksiyskononenko added this to the Release 1.1.0 milestone Nov 29, 2022
oleksiyskononenko pushed a commit that referenced this issue Dec 12, 2022
@oleksiyskononenko
Copy link
Contributor Author

@samukweku I still wonder why this bug was not caught by our tests, even though you've got a test for prod() on the grouped columns. Do you have time to look at this test and adjust it if necessary?

@samukweku
Copy link
Contributor

@oleksiyskononenko sure I'll have a look

@samukweku samukweku reopened this Dec 12, 2022
oleksiyskononenko pushed a commit that referenced this issue Dec 14, 2022
)

- the fix for #3390 has been already pushed as a part of #3388, here we merely add a corresponding test;
- as of #2472, `f[:]` excludes the groupby columns, in this PR we make the corresponding adjustments to the docs. 

Closes #3390
samukweku added a commit that referenced this issue Jan 3, 2023
samukweku added a commit that referenced this issue Jan 3, 2023
)

- the fix for #3390 has been already pushed as a part of #3388, here we merely add a corresponding test;
- as of #2472, `f[:]` excludes the groupby columns, in this PR we make the corresponding adjustments to the docs. 

Closes #3390
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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants