Skip to content

Commit

Permalink
python: fix bug in .str.extract dtype
Browse files Browse the repository at this point in the history
  • Loading branch information
ritchie46 committed Jan 8, 2022
1 parent bf6e189 commit 838f05a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion py-polars/src/lazy/dsl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ impl PyExpr {
};
self.clone()
.inner
.map(function, GetOutput::from_type(DataType::Boolean))
.map(function, GetOutput::from_type(DataType::Utf8))
.into()
}

Expand Down
6 changes: 6 additions & 0 deletions py-polars/tests/test_strings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import polars as pl

def test_extract_binary():
df = pl.DataFrame({'foo': ['aron', 'butler', 'charly', 'david']})
out = df.filter(pl.col('foo').str.extract('^(a)', 1) == 'a').to_series()
assert out[0] == "aron"

0 comments on commit 838f05a

Please sign in to comment.