question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Adding a bin shorthand

See original GitHub issue

Would it be possible to add a shorthand syntax for binning? The exact proposal would be to to allow to replace

alt.Chart(cars).mark_bar().encode(
    x=alt.X("Horsepower", bin=True), 
    y="count()"
)

by

alt.Chart(cars).mark_bar().encode(
    x="bin(Horsepower)", 
    y="count()"
)

After reading through #763 I understand that changes in this direction are not trivial, but I would suppose that just allowing this simple substitution would not break the conceptual model, as one would still have to use alt.X to customize the binning. However, for the default case this substitution should correspond to what is already being done for aggregations.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:15 (11 by maintainers)

github_iconTop GitHub Comments

9reactions
jakevdpcommented, Jun 28, 2019

How often do people use this?

Not much, if at all. We don’t do any direct property access in Altair’s docs or examples, so I think it’s a pretty minor incompatibility all told. And my take is it’s well worth the benefit of being able to do this:

chart.encode(
  x = alt.X('name:Q').bin(maxbins=100).axis(title=None).scale(None)
)

instead of this:

chart.encode(
  x = alt.X('name:Q',
    bin=alt.Bin(maxbins=100),
    axis=alt.Axis(title=None),
    scale=None
  )
)
0reactions
jakevdpcommented, Nov 23, 2019

Prototype & more discussion in #1629

Read more comments on GitHub >

github_iconTop Results From Across the Web

What does BIN stand for? - Abbreviations.com
What does BIN mean? This page is about the various possible meanings of the acronym, abbreviation, shorthand or slang term: BIN.
Read more >
BIN - Urban Dictionary
BIN. Acronym for “Bank Identification Number.” It is the first 6 digits of a credit or debit card. It is useful for scammers...
Read more >
BIN - What does BIN stand for? The Free Dictionary
BIN, Barcode Index Number (Barcode of Life Data System) ; BIN, Buffer Index Number ; BIN, Buy It Now ; BIN, Binary File....
Read more >
Copy a section - Shorthand Support
Shorthand's copy functionality enables you to duplicate any section of a story. The copied section can be used in your current story, or...
Read more >
Shorthand for "import or install"? - python - Stack Overflow
#!/usr/bin/python3 try: import tornado except ImportError: print("Import not ... ...also, invoking a shell (as os.system() does) is adding ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found