Skip to content

Instantly share code, notes, and snippets.

@pabloagn
Last active March 2, 2023 14:28
Show Gist options
  • Save pabloagn/6833c60dc47b5bc6bda1222e89e78147 to your computer and use it in GitHub Desktop.
Save pabloagn/6833c60dc47b5bc6bda1222e89e78147 to your computer and use it in GitHub Desktop.
Figures used in deep dive article: polars-a-lightning-fast-dataframe-library-for-python-and-rust
<script src="https://gist.github.com/pabloagn/6833c60dc47b5bc6bda1222e89e78147.js?file=polars-1.txt"></script>
<script src="https://gist.github.com/pabloagn/6833c60dc47b5bc6bda1222e89e78147.js?file=polars-2.txt"></script>
<script src="https://gist.github.com/pabloagn/6833c60dc47b5bc6bda1222e89e78147.js?file=polars-3.txt"></script>
<script src="https://gist.github.com/pabloagn/6833c60dc47b5bc6bda1222e89e78147.js?file=polars-4.txt"></script>
<script src="https://gist.github.com/pabloagn/6833c60dc47b5bc6bda1222e89e78147.js?file=polars-5.txt"></script>
<script src="https://gist.github.com/pabloagn/6833c60dc47b5bc6bda1222e89e78147.js?file=polars-6.txt"></script>
<script src="https://gist.github.com/pabloagn/6833c60dc47b5bc6bda1222e89e78147.js?file=polars-7.txt"></script>
<script src="https://gist.github.com/pabloagn/6833c60dc47b5bc6bda1222e89e78147.js?file=polars-8.txt"></script>
<script src="https://gist.github.com/pabloagn/6833c60dc47b5bc6bda1222e89e78147.js?file=polars-9.txt"></script>
<script src="https://gist.github.com/pabloagn/6833c60dc47b5bc6bda1222e89e78147.js?file=polars-10.txt"></script>
<script src="https://gist.github.com/pabloagn/6833c60dc47b5bc6bda1222e89e78147.js?file=polars-11.txt"></script>
<script src="https://gist.github.com/pabloagn/6833c60dc47b5bc6bda1222e89e78147.js?file=polars-12.txt"></script>
<script src="https://gist.github.com/pabloagn/6833c60dc47b5bc6bda1222e89e78147.js?file=polars-13.txt"></script>
<script src="https://gist.github.com/pabloagn/6833c60dc47b5bc6bda1222e89e78147.js?file=polars-14.txt"></script>
<script src="https://gist.github.com/pabloagn/6833c60dc47b5bc6bda1222e89e78147.js?file=polars-15.txt"></script>
shape: (3, 3)
┌─────────┬───────────┬─────────────────────┐
│ name ┆ surname ┆ birth │
│ --- ┆ --- ┆ --- │
│ str ┆ str ┆ datetime[μs] │
╞═════════╪═══════════╪═════════════════════╡
│ Jack ┆ Kerouac ┆ 1922-03-12 00:00:00 │
│ Charles ┆ Bukowski ┆ 1920-08-16 00:00:00 │
│ Clarice ┆ Lispector ┆ 1920-12-10 00:00:00 │
└─────────┴───────────┴─────────────────────┘
shape: (5, 2)
+----------+-----------------+
| bedrooms | room_type |
| --- | --- |
| i64 | str |
+============================+
| 2 | Entire home/apt |
| 2 | Entire home/apt |
| 3 | Entire home/apt |
| 2 | Private room |
| 2 | Entire home/apt |
+----------+-----------------+
shape: (0, 2)
+----------+-----------+
| bedrooms | room_type |
| --- | --- |
| i64 | str |
+======================+
+----------+-----------+
┌─────────────┬────────────────────┐
│ room_shared ┆ cleanliness_rating │
│ --- ┆ --- │
│ bool ┆ f64 │
╞═════════════╪════════════════════╡
│ false ┆ 9.462995 │
│ true ┆ 8.973684 │
└─────────────┴────────────────────┘
shape: (3, 4)
+---------+-----------+---------------------+-------------------------------+
| name | surname | birth | book |
| --- | --- | --- | --- |
| str | str | datetime[μs] | str |
+===========================================================================+
| Jack | Kerouac | 1922-03-12 00:00:00 | On The Road |
| Charles | Bukowski | 1920-08-16 00:00:00 | Ham On Rye |
| Clarice | Lispector | 1920-12-10 00:00:00 | The Passion According to G.H. |
+---------+-----------+---------------------+-------------------------------+
shape: (2, 2)
┌────────┬──────────────────┐
│ city ┆ unique_latitudes │
│ --- ┆ --- │
│ str ┆ u32 │
╞════════╪══════════════════╡
│ Berlin ┆ 1076 │
│ Vienna ┆ 1462 │
└────────┴──────────────────┘
┌──────────┬──────────┬──────────┐
│ lng ┆ lat ┆ new_col │
│ --- ┆ --- ┆ --- │
│ f64 ┆ f64 ┆ f64 │
╞══════════╪══════════╪══════════╡
│ 13.42344 ┆ 52.4915 ┆ 0.414997 │
│ 13.503 ┆ 52.509 ┆ 0.397309 │
│ 13.468 ┆ 52.519 ┆ 0.277131 │
│ 13.47096 ┆ 52.51527 ┆ 0.429678 │
│ ... ┆ ... ┆ ... │
│ 13.53187 ┆ 52.40874 ┆ 0.06139 │
│ 13.53301 ┆ 52.40712 ┆ 0.810651 │
│ 13.70702 ┆ 52.42405 ┆ 0.92665 │
│ 13.691 ┆ 52.37 ┆ 0.853674 │
└──────────┴──────────┴──────────┘
shape: (2, 2)
┌─────────────┬─────────────────────┐
│ room_shared ┆ average_cleanliness │
│ --- ┆ --- │
│ bool ┆ f64 │
╞═════════════╪═════════════════════╡
│ false ┆ 9.462995 │
│ true ┆ 8.973684 │
└─────────────┴─────────────────────┘
shape: (124, 1)
┌────────────┐
│ metro_dist │
│ --- │
│ f64 │
╞════════════╡
│ 0.088494 │
│ 0.110308 │
│ 0.12578 │
│ 0.131641 │
│ ... │
│ 2.87661 │
│ 4.512803 │
│ 5.324563 │
│ 9.598773 │
└────────────┘
+------------+------------+-------------+
| describe | column_0 | realSum |
| --- | --- | --- |
| str | f64 | f64 |
+=======================================+
| count | 1200.0 | 1200.0 |
| null_count | 0.0 | 0.0 |
| mean | 599.5 | 249.252516 |
| std | 346.554469 | 240.584178 |
| min | 0.0 | 64.971487 |
| max | 1199.0 | 5856.081144 |
| median | 599.5 | 192.460503 |
+------------+------------+-------------+
...
+-----+------------+-----------------+
| | realSum | room_type |
| --- | --- | --- |
| i64 | f64 | str |
+====================================+
| 636 | 139.29139 | Private room |
| 13 | 577.498364 | Entire home/apt |
| 240 | 291.203141 | Entire home/apt |
| 15 | 127.605871 | Private room |
| 707 | 755.819389 | Private room |
+-----+------------+-----------------+
┌────────────┐
│ realSum │
│ --- │
│ f64 │
╞════════════╡
│ 185.799757 │
│ 387.49182 │
│ 194.914462 │
│ 171.777134 │
│ ... │
│ 134.617182 │
│ 134.617182 │
│ 160.091614 │
│ 359.680284 │
└────────────┘
┌─────────────────┬─────────────┬──────────────┐
│ room_type ┆ room_shared ┆ room_private │
│ --- ┆ --- ┆ --- │
│ str ┆ bool ┆ bool │
╞═════════════════╪═════════════╪══════════════╡
│ Private room ┆ false ┆ true │
│ Entire home/apt ┆ false ┆ false │
│ Private room ┆ false ┆ true │
│ Private room ┆ false ┆ true │
│ ... ┆ ... ┆ ... │
│ Private room ┆ false ┆ true │
│ Private room ┆ false ┆ true │
│ Entire home/apt ┆ false ┆ false │
│ Entire home/apt ┆ false ┆ false │
└─────────────────┴─────────────┴──────────────┘
shape: (1200, 5)
+------+-----------------+-------+-----+----------+
| | person_capacity | multi | biz | bedrooms |
| --- | --- | --- | --- | --- |
| i64 | i64 | i64 | i64 | i64 |
+=================================================+
| 0 | 2 | 0 | 0 | 1 |
| 1 | 6 | 0 | 1 | 2 |
| 2 | 5 | 0 | 1 | 1 |
| 3 | 2 | 0 | 0 | 1 |
| ... | ... | ... | ... | ... |
| 1196 | 4 | 1 | 0 | 1 |
| 1197 | 4 | 1 | 0 | 1 |
| 1198 | 3 | 0 | 0 | 1 |
| 1199 | 4 | 1 | 0 | 1 |
+------+-----------------+-------+-----+----------+
┌────────────┐
│ metro_dist │
│ --- │
│ f64 │
╞════════════╡
│ 0.088494 │
│ 0.110308 │
│ 0.12578 │
│ 0.131641 │
│ 0.135447 │
└────────────┘
┌──────────┬──────────┬────────────────────┐
│ lat ┆ lng ┆ cleanliness_rating │
│ --- ┆ --- ┆ --- │
│ f64 ┆ f64 ┆ f64 │
╞══════════╪══════════╪════════════════════╡
│ 52.4915 ┆ 13.42344 ┆ 10.0 │
│ 52.47842 ┆ 13.5244 ┆ 10.0 │
│ 52.51229 ┆ 13.45862 ┆ 10.0 │
│ 52.49265 ┆ 13.43842 ┆ 10.0 │
│ ... ┆ ... ┆ ... │
│ 52.49937 ┆ 13.35408 ┆ 6.0 │
│ 52.573 ┆ 13.42254 ┆ 6.0 │
│ 52.49168 ┆ 13.30429 ┆ 5.0 │
│ 52.51526 ┆ 13.46914 ┆ 4.0 │
└──────────┴──────────┴────────────────────┘
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment