Open heshamdar opened 3 weeks ago
This has nothing to do with polars 😉
But I agree. This is annoying and bad design imo. You dont always control variable names. I had the same "problem" a few month ago. https://github.com/vega/altair/issues/3599 Unfortunately this is intended behavior of altair (see documentation)
I think we can escape the column names when altair
is set as backend?
thanks @heshamdar for the report!
I think we can escape the column names when altair is set as backend?
sure but if the user's not aware of this being done for them, and they just pass x='x.1'
instead of x='x\.1'
, then they would get
ValueError: Unable to determine data type for the field "x.1"; verify that the field name is not misspelled. If you are referencing a field from a transform, also confirm that the data type is specified correctly.
Maybe the solution is to just raise an informative error from the start if the user's input contains columns with problematic names (like '.'
, ':'
), and just refuse to make a plot at all in such situations? Maybe this should even be done in Altair itself?
Checks
Reproducible example
Log output
No response
Issue description
Columns that include a dot
.
in the name are parsed incorrectly by Altair and so the resulting plots are empty. This behaviour is described here: https://github.com/vega/vega-lite/issues/1775The suggested fix (as mentioned in the discussion) is to wrap the column name in square brackets.
In the provided example the plotting config that gets generated is:
If the config instead includes square brackets in the field encoding it plots correctly:
Expected behavior
Plots generated using columns with
.
are handled correctlyInstalled versions