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

Determine length of column-oriented dataframe? #1088

Open
Fil opened this issue Oct 14, 2022 · 0 comments
Open

Determine length of column-oriented dataframe? #1088

Fil opened this issue Oct 14, 2022 · 0 comments
Labels
enhancement New feature or request question Further information is needed

Comments

@Fil
Copy link
Contributor

Fil commented Oct 14, 2022

Suppose the data is given as an object of columns:

df = {x: [1, 2, 3], y: [1, 2, 3]}

(This is how Quarto returns dataframes, and arquero does something similar.)

To use this in a mark we can call:

Plot.barX(data, {x: df.x, y: df.y, …)

But there is no good way to specify data:

  • if we specify it as {length: n} it will get materialized at some point, which is not optimal if the dataframe has millions of rows.
  • if we pass df.x as data, it is semantically incorrect
  • technically new Array(df.x.length) is fine, but it's a mental stretch

I wonder if we could have either: data = n (a number) —which would be read as new Array(n)—; or a special symbol that would say "use the channels' length". Another useful possibility would be for "dataframe objects" to have some sort of length property.

cc: @allisonhorst ; discussion after reading https://allisonhorst.github.io/posts/2022-10-14-bird-attacks/

@Fil Fil added enhancement New feature or request question Further information is needed labels Oct 14, 2022
Fil added a commit that referenced this issue Mar 10, 2023
Fil added a commit that referenced this issue Mar 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is needed
Projects
None yet
Development

No branches or pull requests

1 participant