The app for independent voices

Hello Veronika,

Thank you for your very pragmatic tutorials, I feel like what I learnt can be easily transposed to my projects.

I had a couple of difficulties to make it through this second tutorial though, here are a couple of things I have noted:

  • In Connecting Even More Data section:

    • it seems like there is a typo in the Polars data engineering steps: you first rename (alias) the column planet to planet_iri, but then, below, you select a planet_uri column that does not exist.

    • Then you load an instance named data I don’t know where it comes from which has a satellites() method:

      m.map_default(data.satellites(), “satellite_uri”)

      I tried to guess and corrected this way:

      m.map_default(df_satellites, "satellite_iri")
    • Then there is a new SPARQL query for which I modified this way in order to get the results:

      PREFIX def: <urn:maplib_default:>
      PREFIX ast: <eurovotech.org/objects-…>
      
      SELECT ?planet (COUNT(?moon) AS ?countMoon)
      WHERE {
          ?moon def:planet_iri ?p.
          ?p def:planet ?planet.
      }
      
      GROUP BY ?planet
      
      >>>
      ┌─────────┬───────────┐
      │ planet  ┆ moonCount │
      │ ---     ┆ ---       │
      │ str     ┆ u32       │
      ╞═════════╪═══════════╡
      │ Mars    ┆ 2         │
      │ Saturn  ┆ 61        │
      │ Pluto   ┆ 5         │
      │ Jupiter ┆ 67        │
      │ Neptune ┆ 14        │
      │ Earth   ┆ 1         │
      │ Uranus  ┆ 27        │
      └─────────┴───────────┘
  • There are some weird quotes in the code of your first and second tutorials that hinder them to be immediately reproducible in an IDE: and .

Also, just a tip, to ease polars DataFrames visualization, there are configurable printing options. For example:

pl.Config.set_tbl_width_chars(width=1000)
pl.Config..set_fmt_str_lengths(200)

Best,

Jan 10
at
5:34 PM

Log in or sign up

Join the most interesting and insightful discussions.