Skip to content

Slow performance of max and min methods of Series #183

@rxmvinv

Description

@rxmvinv

Hello thank you for grate framework.

Please help me to resolve the issue with Series' methods min and max

Sequence of DataFrame is taken on iteration inside select method on it then it's converted to Series and everything works fine and fast before calling min and max methods on Series.

What is the best solution to this issue?

Code is below:

const data_forge_1 = require("data-forge");

function f () {
  return this.select((df, i) => {

      const takeSequence = this.skip(i).take(50);//.bake();

      const ls = takeSequence.getSeries('l');//.bake();

      const hs = takeSequence.getSeries('h');//.bake();

      // with calls to min and max it's starting to work really slowly without calls it's a few seconds
      const min_val = ls.min();
      const max_val = hs.max();

      return {min_val, max_val};

  }).bake()
}

data_forge_1.DataFrame.prototype.f = f;

How it's applied:

const dataForge = require('data-forge');
require('data-forge-fs')

let inputSeries = dataForge.readFileSync("path/to/file.csv") // thousands entities
    .parseCSV()

const f = inputSeries.f();

inputSeries = inputSeries
    .withSeries("f", f);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions