Skip to content

Commit

Permalink
Implement missing str_to_polarstype case for String (#204)
Browse files Browse the repository at this point in the history
* Implement missing `str_to_polarstype` case for String

* test that pl.String works in “df from rows with schema”
  • Loading branch information
controversial committed Apr 29, 2024
1 parent abd3e58 commit 8593fcf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions __tests__/dataframe.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2449,10 +2449,10 @@ describe("additional", () => {
expect(dfs).toEqual(expected);
});
test("df from rows with schema", () => {
const rows = [{ a: 1, b: 2, c: null }];
const rows = [{ a: 1, b: 2, c: null, d: "foo" }];

const df = pl.DataFrame(rows, {
schema: { a: pl.Int32, b: pl.Int32, c: pl.Utf8 },
schema: { a: pl.Int32, b: pl.Int32, c: pl.Utf8, d: pl.String },
orient: "row",
});
const actual = df.toRecords();
Expand Down
1 change: 1 addition & 0 deletions src/conversion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,7 @@ impl FromNapiValue for Wrap<DataType> {
"Float64" => DataType::Float64,
"Bool" => DataType::Boolean,
"Utf8" => DataType::String,
"String" => DataType::String,
"List" => {
let inner = obj.get::<_, Array>("inner")?.unwrap();
let inner_dtype: Object = inner.get::<Object>(0)?.unwrap();
Expand Down

0 comments on commit 8593fcf

Please sign in to comment.