Comments (6)
@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.
@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.
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.
That is because my generic visitors, like min, max, mean, etc., skip nans. I should make it optional.
from dataframe.
@yssource
Made skipping nans optional in visitors. The default is still to skip nans.
See the tester file and docs
from dataframe.
It works as expected.
Thank you, so much.
from dataframe.
Related Issues (20)
- No write to file example HOT 4
- Dataframe length HOT 2
- Plausibility of adapting for C++17 in a fork? HOT 2
- How to filter the DataFrame? HOT 1
- conflict with include <windows.h> HOT 1
- Aggregate visitors can't be used in groupby HOT 3
- Error: specializing member ‘hmdf::DataFrame<int, hmdf::HeteroVector<0> >::set_lock’ requires ‘template<>’ syntax| HOT 9
- Use of std::shared_mutex with shared_lock instead of native locks defined in ThreadGranularity.h HOT 2
- DateTime: Issue with parsing ISO datetime HOT 6
- StdVisitor error with user-defined type HOT 4
- in dynamic libraries, get_column returns an empty data vector HOT 10
- MedianVisitor giving wrong result HOT 2
- Issues while compiling with DataFrame headers HOT 4
- test failed HOT 2
- load_column from single_act_visit.get_result() HOT 3
- failed to compile tests and examples in ubuntu HOT 2
- The `DataFrame.h` occurred an error: `In included file: unknown type name 'requires'` HOT 3
- Compile Failed with `VERSION 2.0.0` HOT 3
- How can I convert the `Eigen Matrix` to `DataFrame` or `DataFrame` to `Eigen Matrix`? HOT 4
- Error compiling on Linux x86_64 with g++ 14.0.1 or Clang 17.0.6 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dataframe.