Giter VIP home page Giter VIP logo

Comments (5)

MarcoGorelli avatar MarcoGorelli commented on May 24, 2024 1

Thanks for reporting, could you make a more minimal example that only uses ewm_mean please? I suspect it's another part of the computation which changed. I think cum_count changed at some point

from polars.

cmdlineluser avatar cmdlineluser commented on May 24, 2024 1

Oh right. .cum_count() start value changed from 0 to 1 in 0.20.4 ... as @MarcoGorelli suggested.

So the code would have to be changed from < 9 to <= 9 or < 10

Although if cum_count null behaviour also changed, something else may need adjusting to handle that?

from polars.

IanAtDazed avatar IanAtDazed commented on May 24, 2024 1

Thank you! My problem is solved! :-)

from polars.

cmdlineluser avatar cmdlineluser commented on May 24, 2024

Things appear to have changed in 0.20.4 and it is before .ewm_mean() is called:

import polars as pl

values = [
    143.15,143.1,143.06,143.01,143.03,143.09,143.14,143.18,
    143.2,143.2,143.2,143.31,143.38,143.35,143.34,143.25,
    143.33,143.3,143.33,143.36
]

(
    pl.DataFrame({'value': values})
      .with_columns(
          pl.when(pl.col('value').cum_count() < 9)
            .then(pl.col('value').head(9).mean())
            .otherwise(pl.col('value'))
      )
      .to_dict(as_series=False)
)

0.20.3

{'value': [143.10666666666668,
  143.10666666666668,
  143.10666666666668,
  143.10666666666668,
  143.10666666666668,
  143.10666666666668,
  143.10666666666668,
  143.10666666666668,
  143.10666666666668,
  143.2,
  143.2,
  143.31,
  143.38,
  143.35,
  143.34,
  143.25,
  143.33,
  143.3,
  143.33,
  143.36]}

0.20.4

{'value': [143.10666666666668,
  143.10666666666668,
  143.10666666666668,
  143.10666666666668,
  143.10666666666668,
  143.10666666666668,
  143.10666666666668,
  143.10666666666668,
  143.2,              # this was 143.10666666666668 in 0.20.3
  143.2,
  143.2,
  143.31,
  143.38,
  143.35,
  143.34,
  143.25,
  143.33,
  143.3,
  143.33,
  143.36]}

from polars.

IanAtDazed avatar IanAtDazed commented on May 24, 2024

Solved!

from polars.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.