Skip to content

Commit

Permalink
Merge pull request #19 from edavidaja/penguins
Browse files Browse the repository at this point in the history
vendor penguins data
  • Loading branch information
machow authored Oct 18, 2024
2 parents 3856082 + 1b50f00 commit 934c69f
Show file tree
Hide file tree
Showing 10 changed files with 372 additions and 21 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ jobs:
- name: Create Github Deployment
uses: bobheadxi/[email protected]
id: deployment
if: ${{ !github.event.pull_request.head.repo.fork }}
with:
step: start
token: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -52,6 +53,7 @@ jobs:
logs: "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"

- name: Netlify docs preview
if: ${{ !github.event.pull_request.head.repo.fork }}
run: |
npm install -g netlify-cli
# push main branch to production, others to preview --
Expand All @@ -67,7 +69,7 @@ jobs:

- name: Update Github Deployment
uses: bobheadxi/[email protected]
if: ${{ always() }}
if: ${{ !github.event.pull_request.head.repo.fork && always() }}
with:
step: finish
token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
6 changes: 2 additions & 4 deletions docs/get-started/controls-click-actions.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,13 @@ You can add cell click actions using the onClick argument, which accepts the fol
import htmltools
from reactable import Reactable, Column, JS, embed_css
from reactable.data import cars_93
from palmerpenguins import load_penguins
from reactable.data import cars_93, penguins
import polars as pl
embed_css()
penguins = load_penguins()
pl_penguins = pl.from_pandas(penguins)
pl_penguins = penguins.to_polars()
```


Expand Down
6 changes: 2 additions & 4 deletions docs/get-started/controls-filtering.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@ title: Filtering

```{python}
from reactable import Reactable, Column, JS, embed_css
from reactable.data import cars_93
from reactable.data import cars_93, penguins
from palmerpenguins import load_penguins
import polars as pl
embed_css()
penguins = load_penguins()
pl_penguins = pl.from_pandas(penguins)
pl_penguins = penguins.to_polars()
cars = cars_93[:20, ["manufacturer", "model", "type", "air_bags", "price"]]
```
Expand Down
5 changes: 2 additions & 3 deletions docs/get-started/controls-sorting.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@ jupyter: python3

```{python}
from reactable import Reactable, Column, embed_css
from reactable.data import penguins
from palmerpenguins import load_penguins
import polars as pl
embed_css()
penguins = load_penguins()
pl_penguins = pl.from_pandas(penguins)
pl_penguins = penguins.to_polars()
```

Tables are sortable by default. You can sort a column by clicking on its header, or sort multiple columns by holding the shift key while sorting.
Expand Down
5 changes: 2 additions & 3 deletions docs/get-started/structure-column-groups.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ title: Column headers
import polars as pl
from reactable import Reactable, Column, ColGroup, embed_css
from palmerpenguins import load_penguins
from reactable.data import penguins
penguins = load_penguins()
pl_penguins = pl.from_pandas(penguins)
pl_penguins = penguins.to_polars()
embed_css()
```
Expand Down
5 changes: 2 additions & 3 deletions docs/get-started/structure-details.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@ title: Expandable details

```{python}
from reactable import Reactable, Column, ColFormat, JS, embed_css
from reactable.data import penguins
from palmerpenguins import load_penguins
import polars as pl
embed_css()
penguins = load_penguins()
pl_penguins = pl.from_pandas(penguins)
pl_penguins = penguins.to_polars()
```

You can make rows expandable with additional content through details, which takes an Python or JavaScript render function. See [Custom Rendering](./format-custom-rendering.qmd) for details on how to use render functions.
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ dependencies = [
"IPython",
"importlib-metadata",
"importlib-resources",
"palmerpenguins",
"typing_extensions>=3.10.0.0",
]
requires-python = ">=3.9"
Expand Down
12 changes: 12 additions & 0 deletions reactable/data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"cars_93",
"co2",
"nottem",
"penguins",
"prices",
"sleep",
"starwars",
Expand Down Expand Up @@ -53,6 +54,17 @@
)
)

penguins = SimpleFrame.read_csv(BIG_DATA / "penguins.csv").cast(
dict(
bill_length_mm=float,
bill_depth_mm=float,
flipper_length_mm=float,
body_mass_g=float,
year=int,
sex=str
),
na_char="NA"
)

prices = SimpleFrame.from_dict(
{
Expand Down
Loading

0 comments on commit 934c69f

Please sign in to comment.