Skip to content

Data source in Jupyter needs full URL #2432

Open

Description

In Jupyter Lab I have seattle-weather.csv, bar.vl.json and a notebook all in the same folder. The data is from the example data sets, as is the Vega Lite:

{
  "$schema": "https://vega.github.io/schema/vega-lite/v5.json",
  "data": {"url": "seattle-weather.csv"},
  "mark": "bar",
  "encoding": {
    "x": {"timeUnit": "month", "field": "date", "type": "ordinal"},
    "y": {"aggregate": "count", "type": "quantitative"},
    "color": {"field": "weather", "type": "nominal"}
  }
}

Opening the Vega Lite file directly creates a tab with the bar chart rendered as expected. In the notebook I need to pass the full URL to Altair to create the same visualisation:

alt.Chart('http://localhost:8888/files/seattle-weather.csv').mark_bar().encode(
    x='month(date):O',
    y='count():Q',
    color='weather:N'
)

Why does alt.Chart('seattle-weather.csv')..... not work in the notebook? Can the docs be updated to include guidance around this use case scenario?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions