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

Improve syntax for argmin/max #1642

Open
kanitw opened this issue Aug 6, 2019 · 2 comments
Open

Improve syntax for argmin/max #1642

kanitw opened this issue Aug 6, 2019 · 2 comments

Comments

@kanitw
Copy link
Member

kanitw commented Aug 6, 2019

Right now we need something like

alt.Y(aggregate=alt.ArgmaxDef(argmax=<f>), field=..., type=...)

to make the following in Vega-Lite:

{aggregate: {argmax: <f>}, field: ..., type: ...}

It would be more natural to allow:

alt.Y(aggregate=alt.Argmax(<f>), field=..., type=...)

Same for argmin. :)

@jakevdp
Copy link
Collaborator

jakevdp commented Aug 6, 2019

That syntax should work currently without the keyword

>>> import altair as alt
>>> alt.X('x:Q', aggregate=alt.ArgminDef('y')).to_dict()
{'aggregate': {'argmin': 'y'}, 'field': 'x', 'type': 'quantitative'}

@kanitw
Copy link
Member Author

kanitw commented Aug 6, 2019

Ah i see. The only question is whether we should cut ‘Def’ suffix to make it more reader friendly. If you agree, i can fix it from Vega-Lite schema as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants