Skip to content

Commit 8593fcf

Browse files
Implement missing str_to_polarstype case for String (#204)
* Implement missing `str_to_polarstype` case for String * test that pl.String works in “df from rows with schema”
1 parent abd3e58 commit 8593fcf

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

__tests__/dataframe.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -2449,10 +2449,10 @@ describe("additional", () => {
24492449
expect(dfs).toEqual(expected);
24502450
});
24512451
test("df from rows with schema", () => {
2452-
const rows = [{ a: 1, b: 2, c: null }];
2452+
const rows = [{ a: 1, b: 2, c: null, d: "foo" }];
24532453

24542454
const df = pl.DataFrame(rows, {
2455-
schema: { a: pl.Int32, b: pl.Int32, c: pl.Utf8 },
2455+
schema: { a: pl.Int32, b: pl.Int32, c: pl.Utf8, d: pl.String },
24562456
orient: "row",
24572457
});
24582458
const actual = df.toRecords();

src/conversion.rs

+1
Original file line numberDiff line numberDiff line change
@@ -657,6 +657,7 @@ impl FromNapiValue for Wrap<DataType> {
657657
"Float64" => DataType::Float64,
658658
"Bool" => DataType::Boolean,
659659
"Utf8" => DataType::String,
660+
"String" => DataType::String,
660661
"List" => {
661662
let inner = obj.get::<_, Array>("inner")?.unwrap();
662663
let inner_dtype: Object = inner.get::<Object>(0)?.unwrap();

0 commit comments

Comments
 (0)