Questions tagged [nodejs-polars]

10 questions
4
votes
1 answer

How to perform computations easily between every column in a polars DataFrame and the mean of that column

Environment macos: monterey node: v18.1.0 nodejs-polars: 0.5.3 Goal Subtract every column in a polars DataFrame with the mean of that column. Pandas solution In pandas the solution is very concise thanks to…
3
votes
1 answer

How can I share a lazy dataframe between different runtimes?

I have a desktop application where the majority of calculations (>90%) happen on the Rust side of it. But I want the user to be able to write scripts in Python that will operate on the df. Can this be done without serializing the dataframe between…
mainrs
  • 43
  • 3
2
votes
2 answers

Abstract out Polars expressions with user-defined chainable functions on the `DataFrame`

Motivation Abstract out parametrized (via custom function parameters) chainable (preferably via the DataFrame.prototype) Polars expressions to provide user-defined, higher-level, reusable and chainable data analysis functions on the…
2
votes
2 answers

window agg over one value, but return another via Polars

I am trying to use polars to do a window aggregate over one value, but map it back to another. For example, if i wanted to get the name of the max value in a group, instead of (or in combination to) just the max value. assuming an input of something…
Cory Grinstead
  • 511
  • 3
  • 16
1
vote
0 answers

No loader is configured for ".node" files

I am getting this error when trying to load nodejs-polars into a React Vite application. Does anyone know how to get this to load properly? ✘ [ERROR] No loader is configured for ".node" files:…
Jordan
  • 11
  • 1
1
vote
1 answer

py-polars: groupby_dynamic but via expressions. (timestamp based window functions)

df = pl.DataFrame({ 'txn_id': ['0x5...60', '0x1...6d', '0x9...84', '0xc...25', '0x5...50', '0xe...14', '0x2...f3', '0xe...75', '0x3...95', '0x4...4e'], 'txn_grouping': ['0x4...dd', '0x4...dd', '0xf...e2', '0x4...17', '0xe...8b', '0x6...4e',…
1
vote
1 answer

Convert javascript object to polars dataframe in node.js and populate missing values with null

I'm trying to use nodejs-polars library but have encountered a problem converting a javascript object to a polars dataframe. Consider the following data for example const myData = [ { "id": "a", "name": "fred", "country":…
Emman
  • 3,695
  • 2
  • 20
  • 44
0
votes
1 answer

node-js polars List context and row wise compute

I'm trying to use the nodejs bindings for the polars library to calculate the results of ranked choice elections in a hypothetical space. I was able to get this working through the python bindings here without too much trouble, but it depends on…
Sam Schick
  • 400
  • 3
  • 14
0
votes
1 answer

How to directly filter an unpivoted LazyDataFrame without having to collect?

I would like to filter an unpivoted LazyDataFrame by using nodejs-polars without having to collect (and lose the LazyDataFrame) in between. Consider the following example…
0
votes
1 answer

How to apply conditional logic to a column sorted by another column within each group

Given the data frame const df = new DataFrame({ group: ["a", "a", "a", "a", "a", "a", "b", "b", "b", "b", "b", "b"], ts: [ new Date("2022-06-08T00:00:01"), new Date("2022-06-08T00:00:06"), new Date("2022-06-08T00:00:11"), new…