-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improvement: showcase loading external data (#1)
- Loading branch information
Showing
6 changed files
with
140 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
_site/ | ||
|
||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
import marimo | ||
|
||
__generated_with = "0.10.9" | ||
app = marimo.App(width="medium") | ||
|
||
|
||
@app.cell | ||
def _(): | ||
import polars as pl | ||
import marimo as mo | ||
import altair as alt | ||
return alt, mo, pl | ||
|
||
|
||
@app.cell(hide_code=True) | ||
def _(mo): | ||
mo.md( | ||
""" | ||
# Palmer Penguins Analysis | ||
Analyzing the Palmer Penguins dataset using Polars and marimo. | ||
""" | ||
) | ||
return | ||
|
||
|
||
@app.cell | ||
def _(mo, pl): | ||
# Read the penguins dataset | ||
df = pl.read_csv(mo.notebook_location() / "public" / "penguins.csv") | ||
df.head() | ||
return (df,) | ||
|
||
|
||
@app.cell | ||
def _(df, mo): | ||
# Basic statistics | ||
mo.md(f""" | ||
### Dataset Overview | ||
- Total records: {df.height} | ||
- Columns: {', '.join(df.columns)} | ||
### Summary Statistics | ||
{mo.as_html(df.describe())} | ||
""") | ||
return | ||
|
||
|
||
@app.cell(hide_code=True) | ||
def _(mo): | ||
mo.md(r"""### Species Distribution""") | ||
return | ||
|
||
|
||
@app.cell | ||
def _(alt, df, mo): | ||
# Create species distribution chart | ||
species_chart = mo.ui.altair_chart( | ||
alt.Chart(df) | ||
.mark_bar() | ||
.encode(x="species", y="count()", color="species") | ||
.properties(title="Distribution of Penguin Species"), | ||
chart_selection=None, | ||
) | ||
|
||
species_chart | ||
return (species_chart,) | ||
|
||
|
||
@app.cell(hide_code=True) | ||
def _(mo): | ||
mo.md(r"""### Bill Dimensions Analysis""") | ||
return | ||
|
||
|
||
@app.cell | ||
def _(alt, df, mo): | ||
# Scatter plot of bill dimensions | ||
scatter = mo.ui.altair_chart( | ||
alt.Chart(df) | ||
.mark_point() | ||
.encode( | ||
x="bill_length_mm", | ||
y="bill_depth_mm", | ||
color="species", | ||
tooltip=["species", "bill_length_mm", "bill_depth_mm"], | ||
) | ||
.properties(title="Bill Length vs Depth by Species"), | ||
chart_selection=None, | ||
) | ||
|
||
scatter | ||
return (scatter,) | ||
|
||
|
||
if __name__ == "__main__": | ||
app.run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters