Skip to content

Commit

Permalink
catch warning in example
Browse files Browse the repository at this point in the history
  • Loading branch information
stinodego committed Nov 18, 2024
1 parent 1b8ae1b commit 5bde56e
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@
# --8<-- [end:stringcache-categorical-comparison-physical]

# --8<-- [start:concatenating-categoricals]
import warnings

from polars.exceptions import CategoricalRemappingWarning

male_bears = pl.DataFrame(
{
"species": ["Polar", "Brown", "Panda"],
Expand All @@ -130,7 +134,10 @@
schema_overrides={"species": pl.Categorical},
)

bears = pl.concat([male_bears, female_bears], how="vertical")
with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=CategoricalRemappingWarning)
bears = pl.concat([male_bears, female_bears], how="vertical")

print(bears)
# --8<-- [end:concatenating-categoricals]

Expand Down

0 comments on commit 5bde56e

Please sign in to comment.