Comments (4)
Debugging a bit I found that the problem is with the null
values. However, it is expected to have null
values in a database. So, I don't know if this should be tagged as a bug.
from nodejs-polars.
The inference used to detect the schemas for readRecords
is a bit behind the upstream polars
. Updating that to use the latest code from polars
should likely fix most inference related issues.
the nodejs readRecords
should behave identically to the python from_dicts
. So if you are able to create using python from_dicts
, then it is definitely a bug in nodejs-polars
. Otherwise, i'd suggest opening up an issue with polars.
from nodejs-polars.
I tried in both languages and in Python works properly:
Python:
import polars as pl
test = [
{"a": 1, "b": "a", "c": "x"},
{"a": 2, "b": None, "c": "y"},
]
test_df = pl.from_dicts(test)
print(test_df)
# shape: (2, 3)
#┌─────┬──────┬─────┐
#│ a ┆ b ┆ c │
#│ --- ┆ --- ┆ --- │
#│ i64 ┆ str ┆ str │
#╞═════╪══════╪═════╡
#│ 1 ┆ a ┆ x │
#│ 2 ┆ null ┆ y │
#└─────┴──────┴─────┘
Nodejs:
const pl = require("nodejs-polars")
let test = [
{a: 1, b: "a", c:"x"},
{a: 2, b: null, c: "y"}
]
let testDF = pl.readRecords(test)
console.log(testDF)
// thread '<unnamed>' panicked at 'called `Option::unwrap()` on a `None` value', src\dataframe.rs:1527:29
// note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
However, it works if the null values are dropped:
const pl = require("nodejs-polars")
let test = [
{a: 1, b: "a", c:"x"},
{a: 2, c: "y"}
]
let testDF = pl.readRecords(test)
console.log(testDF)
// shape: (2, 3)
// ┌─────┬──────┬─────┐
// │ a ┆ b ┆ c │
// │ --- ┆ --- ┆ --- │
// │ f64 ┆ str ┆ str │
// ╞═════╪══════╪═════╡
// │ 1.0 ┆ a ┆ x │
// ├╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌┤
// │ 2.0 ┆ null ┆ y │
// └─────┴──────┴─────┘
from nodejs-polars.
This issue is fixed in 0.8.0.
Please try it, if it works, please close the ticket. Thx
from nodejs-polars.
Related Issues (20)
- generic signature for dataframes and series HOT 2
- InferSchemaLenght it does not work HOT 2
- pl.readCSV fail with tab separator HOT 5
- filtering by equals doesn't work HOT 3
- `polars.SQLContext` like feature for `node-polars `
- Add `DataFrame.upsample`
- error with filter when trying documentation example HOT 1
- ```valueCounts()``` function always returns ```null```
- DataFrame - `schema_overrides` param is missing HOT 3
- Pivot not working as expected HOT 5
- Add support for reading Delta tables HOT 5
- separator in pivot function HOT 2
- pivot function documentation error HOT 2
- Series constructor ignores dtype HOT 2
- groupBy on a single column DF produces no result
- Transpose option `columnNames` is not working
- Expanded expression support for nodejs-polars HOT 4
- Panic when passing a schema that includes a `String` column HOT 1
- `Series.toTypedArrays()` fails after `.dropNulls()`
- Add support for Decimal DataType HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nodejs-polars.