[Python] Visualizing total and filled slots across multiple categories?

Discussão em 'Python' iniciado por Stack, Abril 3, 2025.

  1. Stack

    Stack Membro Participativo

    I need to visualize some parking occupancy data, shaped something like this:

    ┌──────┬─────┬──────────┬───────┐
    │ zone ┆ lot ┆ occupied ┆ total │
    │ --- ┆ --- ┆ --- ┆ --- │
    │ str ┆ str ┆ i64 ┆ i64 │
    ╞══════╪═════╪══════════╪═══════╡
    │ A ┆ A1 ┆ 80 ┆ 100 │
    │ A ┆ A2 ┆ 25 ┆ 50 │
    │ B ┆ B1 ┆ 15 ┆ 50 │
    │ B ┆ B2 ┆ 25 ┆ 25 │
    └──────┴─────┴──────────┴───────┘


    I had in mind to make a treemap with 'zone' as the parent and each lot's rectangle showing the proportion occupied as a kind of 'fill' of the total rectangle area, but I can't figure out whether or not this is possible in a treemap. Plotly Express is my usual comfort zone, but I'm open to any ideas.

    Also open to alternative visualizations if there's a better option than a treemap.

    Thanks!

    Continue reading...

Compartilhe esta Página