0

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 list context features, specifically pl.element(), in order to do some of the calculations. The problem I'm running into is that there does not appear to be an equivalent feature in the nodejs bindings. Is there a different way to talk about the element of a list through the nodejs bindings? Is there a way to do something like this;

lambda loser: pl.col("vote").arr.eval(pl.element().filter(pl.element() != loser)).alias("vote")

without using pl.element()?

Progman
  • 16,827
  • 6
  • 33
  • 48
Sam Schick
  • 400
  • 3
  • 14

1 Answers1

1

Currently JS bindings do not have pl.element, but under the hood, it is just an alias for an empty string.

loser => pl.col("vote").arr.eval(
    pl.col("").filter(pl.col("").neq(loser))
  ).alias("vote")
Cory Grinstead
  • 511
  • 3
  • 16