Skip to content

Commit

Permalink
docs: add polars snippets
Browse files Browse the repository at this point in the history
  • Loading branch information
niekdt committed Sep 8, 2024
1 parent 7be0982 commit cf2449e
Showing 1 changed file with 29 additions and 2 deletions.
31 changes: 29 additions & 2 deletions src/actionsheets/data/python/polars/polars.dataframe.toml
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,16 @@ code = "data.is_empty()"
action = "Data frames are equal"
code = "data.equals(data2)"

[test.cols.null.any]
action = "Any column contains null row"
code = "any(col.has_nulls() for col in data)"

[test.cols.null.all]
action = "Any column is filled with nulls"
code = "any(col.is_null().all() for col in data)"

[test.col]
section = "Columns"
section = "Tests for specific column(s)"

[test.col.contains]
action = "Contains column"
Expand Down Expand Up @@ -396,9 +403,25 @@ code = "data.fill_nan(value)"


[derive.transform.mask]
section = "Mask"
section = "Row mask"
description = "All snippets output a `pl.Series` object. Use `.to_list()` to obtain list output."

[derive.transform.mask.null.any]
action = "Mask indicating whether rows contain null in any column"
code = """
data.select(
pl.any_horizontal(pl.all().is_null())
).to_series()
"""

[derive.transform.mask.null.all]
action = "Mask indicating whether rows contain null in all columns"
code = """
data.select(
pl.all_horizontal(pl.all().is_null())
).to_series()
"""

[derive.transform.mask.row.duplicate]
action = "Mask indicating duplicate rows"
code = "data.is_duplicated()"
Expand Down Expand Up @@ -1014,6 +1037,10 @@ code = "data.join(data2, on = ['sex', 'country'], how = 'anti')"
[convert]
section = "Convert"

[convert.series]
action = "To series (first column only)"
code = "data.to_series()"

[convert.lazy]
action = "To `polars.LazyFrame`"
code = "data.lazy()"
Expand Down

0 comments on commit cf2449e

Please sign in to comment.