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

count() inside aggregate/joinaggregate transform returns 0 instead of the length of the data #505

Open
joelostblom opened this issue Aug 21, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@joelostblom
Copy link

Take this code as an example:

import altair as alt
import pandas as pd

source = pd.DataFrame({
    'a': ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I'],
    'b': [28, 55, 43, 91, 81, 53, 19, 87, 52]
})

alt.Chart(source).mark_bar().encode(
    x='a',
    y='total:Q'
).transform_joinaggregate(
    total='count()',
    # groupby=['a']
).transformed_data()

The result with vegafusion enabled is 0 for the total column:

image

Whereas it is 9 when vegafusion is not enabled (Open the Chart in the Vega Editor):

image

If I uncomment the groupby above, the result is 1 in both cases:

image

image

@jonmmease jonmmease added the bug Something isn't working label Aug 25, 2024
@jonmmease
Copy link
Collaborator

Thanks for the report Joel, and for diagnosing that the issue arises with the lack of a groupby.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants