Skip to content

Multiple Arithmetic and Comparison Operations are NOT Supported between Two Series #321

@qiao

Description

@qiao

Have you tried latest version of polars?

Yes

What version of polars are you using?

0.18.0

What operating system are you using polars on?

MacOS 15.3.1

What node version are you using

node 23.10.0

Describe your bug.

Multiple arithmetic and comparison operations are not supported between two series.
Here's the list of operations that I have tested and the ones that support operations between two series are marked with the checkmark:

  • add
  • div
  • divideBy
  • minus
  • modulo
  • mul
  • multiplyBy
  • plus
  • rem
  • sub
  • eq
  • equals
  • greaterThan
  • greaterThanEquals
  • gt
  • gtEq
  • lessThan
  • lessThanEquals
  • lt
  • ltEq
  • neq
  • notEquals

The above checklist is generated with the following script:

const pl = require('nodejs-polars');
const a = pl.Series([1]);
const b = pl.Series([2]);

[
  'add',
  'div',
  'divideBy',
  'minus',
  'modulo',
  'mul',
  'multiplyBy',
  'plus',
  'rem',
  'sub',
  'eq',
  'equals',
  'greaterThan',
  'greaterThanEquals',
  'gt',
  'gtEq',
  'lessThan',
  'lessThanEquals',
  'lt',
  'ltEq',
  'neq',
  'notEquals'
].forEach((op) => {
  try {
    a[op](b);
    console.log(`- [X] ${op}`);
  } catch (e) {
    console.log(`- [ ] ${op}`);
  }
});

What are the steps to reproduce the behavior?

const pl = require('nodejs-polars')

const a = pl.Series([1, 1, 1]);
const b = pl.Series([2, 2, 2]);
a.add(b);

What is the actual behavior?

Uncaught Error
    at dtypeWrap (/opt/homebrew/lib/node_modules/nodejs-polars/bin/series/index.js:30:65)
    at Proxy.add (/opt/homebrew/lib/node_modules/nodejs-polars/bin/series/index.js:92:20) {
  code: 'DateExpected'
}

What is the expected behavior?

The above snippet should return pl.Series([3, 3, 3]).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions