You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the code below, we combine columns into an array by passing them as a list inside the JS expression string. This is not possible to replicate with a python expression using alt.datum since transform calculate will not accept a list (and neither will alt.expr). This is another case (in addition to #3366 where the python expression don't cover everything the JS expressions can do), and it would be great if we could somehow support using python expressions for this too (maybe we need alt.expr.array(...) or similar?).
importpandasaspdimportaltairasaltmpg=pd.read_csv('https://raw.githubusercontent.com/has2k1/plotnine/4159f9548fa5f95c02366efc324e88f9ba79af09/plotnine/data/mpg.csv')
alt.Chart(mpg, width=100, height=100).mark_point().transform_calculate(
man_model_drv='[datum.manufacturer, datum.model, datum.drv]'# Does not work# man_model_drv=[alt.datum.manufacturer, alt.datum.model, alt.datum.drv]
).encode(
x='cty',
y='hwy',
).facet(
'man_model_drv:N',
columns=7
)
While it is not the most intuitive, it is at least convenient to type out. Not sure if it is still worthwhile creating toArray in VL, or just using slice when it is needed. Another option would be to just create expr.array(...) in altair as an alias for expr.slice(..., 0).
What is your suggestion?
In the code below, we combine columns into an array by passing them as a list inside the JS expression string. This is not possible to replicate with a python expression using
alt.datum
since transform calculate will not accept a list (and neither willalt.expr
). This is another case (in addition to #3366 where the python expression don't cover everything the JS expressions can do), and it would be great if we could somehow support using python expressions for this too (maybe we needalt.expr.array(...)
or similar?).ref #3601 (reply in thread)
Have you considered any alternative solutions?
No response
The text was updated successfully, but these errors were encountered: