From 7df7b38d6be1070be06a937d6a5b5346fc6e9326 Mon Sep 17 00:00:00 2001 From: Raoul Schram Date: Fri, 13 Oct 2023 10:18:27 +0200 Subject: [PATCH] Fix polars deprecation warning --- pyproject.toml | 2 +- regexmodel/regexclass.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index a6186d7..b68f855 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,7 +23,7 @@ classifiers = [ ] dependencies = [ - "polars>=0.14.17", + "polars>=0.19.8", "numpy>=1.20", ] diff --git a/regexmodel/regexclass.py b/regexmodel/regexclass.py index 6981a20..eb2dcdc 100644 --- a/regexmodel/regexclass.py +++ b/regexmodel/regexclass.py @@ -318,7 +318,7 @@ def score(series: pl.Series, regex: BaseRegex, count_thres: int, n_unique = regex.n_possible else: n_unique = len(first_char.drop_nulls().unique()) - avg_len_next = next_series.drop_nulls().str.lengths().mean() + avg_len_next = next_series.drop_nulls().str.len_chars().mean() if (next_not_null == 0 or next_not_null < count_thres or avg_len_next is None): return 0, next_series, first_char fraction_match = next_not_null/cur_not_null