-
-
Notifications
You must be signed in to change notification settings - Fork 831
Open
Labels
Description
What happened?
When creating a stacked bar chart in a marimo notebook, if some of the rows contains nulls, the results are very unexpected:
import marimo as mo
import altair as alt
import polars as pl
df = pl.from_dict(
{
"Name": [
"chevrolet chevelle malibu",
"buick skylark 320",
"plymouth satellite",
"amc rebel sst",
"ford torino",
],
"Cylinders": ["2c", "2c", "4c", "4c", "6c"],
"Horsepower": [None, 165, 150, 150, 140],
}
)
df
for stack in (True, False):
_chart = (
alt.Chart(df)
.mark_bar()
.encode(
x=alt.X(field="Cylinders", type="nominal"),
y=alt.Y(
field="Horsepower", type="quantitative", stack=stack, aggregate="sum"
),
color=alt.Color(field="Name", type="nominal"),
)
)
mo.output.append(_chart)
when stack=True, i'm guessing it attempts to add the None to the value, but instead of failing, it turns everything into None
What would you like to happen instead?
either an exception or more gracefully ignoring the None entries, but probably an exception feels more correct?
Which version of Altair are you using?
6.0.0