GithubHelp home page GithubHelp logo

Comments (6)

hosseinmoein avatar hosseinmoein commented on May 12, 2024

@yssource
You could write a simple functor and use one of the visit() or single_act_visit() methods to get this result.
But I can add something specialized maybe in the next few days or so

from dataframe.

hosseinmoein avatar hosseinmoein commented on May 12, 2024

@yssource
I implemented the SimpleRollAdptor. It works with most of the visitors.
Please see the doc and data_frame_tester.cc for usage

from dataframe.

yssource avatar yssource commented on May 12, 2024

It seems that the NaN is not considered.

std::vector<double> d1 = {1, 2, 3, 4, 
// 5, 
std::numeric_limits<double>::quiet_NaN(), 
6,
 // 7, 
std::numeric_limits<double>::quiet_NaN(), 
8, 9, 10, 11};
#+begin_src python :results output
  import numpy as np
  import pandas as pd

  x = np.array([0, 1, 2, 3, np.nan, 5, 6, 7, 8, np.nan, 10])
  s = pd.Series(x)

  print(s.rolling(3).min())
  print(s.rolling(3).max())
  print(s.rolling(3).mean())
  print(s.rolling(3).std())
#+end_src

#+RESULTS:
#+begin_example
0     NaN
1     NaN
2     0.0
3     1.0
4     NaN
5     NaN
6     NaN
7     5.0
8     6.0
9     NaN
10    NaN
dtype: float64
0     NaN
1     NaN
2     2.0
3     3.0
4     NaN
5     NaN
6     NaN
7     7.0
8     8.0
9     NaN
10    NaN
dtype: float64
0     NaN
1     NaN
2     1.0
3     2.0
4     NaN
5     NaN
6     NaN
7     6.0
8     7.0
9     NaN
10    NaN
dtype: float64
0     NaN
1     NaN
2     1.0
3     1.0
4     NaN
5     NaN
6     NaN
7     1.0
8     1.0
9     NaN
10    NaN
dtype: float64
#+end_example

from dataframe.

hosseinmoein avatar hosseinmoein commented on May 12, 2024

That is because my generic visitors, like min, max, mean, etc., skip nans. I should make it optional.

from dataframe.

hosseinmoein avatar hosseinmoein commented on May 12, 2024

@yssource
Made skipping nans optional in visitors. The default is still to skip nans.
See the tester file and docs

from dataframe.

yssource avatar yssource commented on May 12, 2024

It works as expected.
Thank you, so much.

from dataframe.

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.