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.

plotting a column name with '.' in it eventually leads to a vega error

See original GitHub issue

I’m doing an Altair chart with a color given by color=Color('gpuinfo.name:N', .... This produces an eventual Vega error.

(Why do I have a column with a period in its name? Reading nested JSONs into pandas is nicely handled by json_normalize, which flattens nested JSON levels into dot-separated column names.)

undefined:3
return x["gpuinfo"]["name"];
                   ^

TypeError: Cannot read property 'name' of undefined
    at Object.eval [as get] (eval at <anonymous> (/Users/jowens/Documents/working/vega/node_modules/datalib/src/util.js:147:20), <anonymous>:3:20)
    at Facetor.proto._cellkey (/Users/jowens/Documents/working/vega/node_modules/datalib/src/aggregate/aggregator.js:106:23)
    at Facetor.proto._cell (/Users/jowens/Documents/working/vega/node_modules/datalib/src/aggregate/aggregator.js:114:38)
    at Facetor.proto._add (/Users/jowens/Documents/working/vega/node_modules/datalib/src/aggregate/aggregator.js:151:19)
    at add (/Users/jowens/Documents/working/vega/src/transforms/Aggregate.js:174:31)
    at Array.forEach (native)
    at Aggregate.prototype.transform (/Users/jowens/Documents/working/vega/src/transforms/Aggregate.js:190:13)
    at Aggregate.prototype.evaluate (/Users/jowens/Documents/working/vega/src/transforms/Transform.js:48:15)
    at Node.dataRef (/Users/jowens/Documents/working/vega/src/scene/Scale.js:387:15)
    at Node.ordinal (/Users/jowens/Documents/working/vega/src/scene/Scale.js:127:20)

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
jakevdpcommented, Feb 7, 2019

This is expected: x.x is one way Vega-Lite uses to refer to hierarchical data. If you want to use special characters in field names, they should be escaped. e.g.

alt.Chart(df).mark_line().encode(x=r"x\.x:Q", y="x\.x:Q")

This is true regardless of the Altair/Vega-Lite version you are using.

For more information, see field under Encoding Channel Options

0reactions
jakevdpcommented, Feb 7, 2019

Great, glad you got it working.

Regarding auto-escaping, there’s no functionality built-in for that… it would be a useful feature to have.

Read more comments on GitHub >

github_iconTop Results From Across the Web

plotting a column name with '.' in it eventually leads to a vega ...
I'm doing an Altair chart with a color given by color=Color('gpuinfo.name:N', ... . This produces an eventual Vega error.
Read more >
How can I overcome issue on column name of the given data ...
I have been trying to extract some data from a DataFrame, where I ran into this issue. While I am trying to plot...
Read more >
TOPCAT - Tool for OPerations on Catalogues And Tables
Plot columns against each other in 1, 2 and 3 dimensions, distinguishing different subsets; Calculate statistics on each column for some or all ......
Read more >
OmniSci Release Notes
Fixed an issue importing MULTIPOLYGON columns from PostGIS via SQL Importer. ... Fixed issue where empty string as group name causes server program...
Read more >
tescan_vega3_sem_manual.pdf - Dartmouth
The VEGA 3 SEM column has a fixed aperture placed over the intermediate and objective lenses and scanning coils.
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