Skip to main content
Filter by
Sorted by
Tagged with
1 vote
0 answers
83 views

I'm trying to perform rolling regression on a matrix with missing values and calculate residuals for each row. Specifically, I want to use a rolling window of length 3 where for each window, the ...
xinyu zhang's user avatar
0 votes
0 answers
168 views

I'm working with a large Polars LazyFrame and computing rolling aggregations grouped by customer (Cusid). I need to find the "front" of the rolling window (last Tts_date) for each group to ...
Liisjak's user avatar
  • 37
3 votes
1 answer
71 views

I recently came across some behaviour in the way that some of the Polars rolling functions work that I don't understand. The problem seems to only present itself when there is a NaN (np.nan) as well ...
Arran's user avatar
  • 95
0 votes
0 answers
69 views

I'm developing a live trading bot in Python that fetches OHLCV data (e.g., 15m candles) and computes a large number of features—rolling indicators (VWAP/Volume-ADI,SMA/EMA/ATR/RSI), price action, ...
bolt investor's user avatar
0 votes
1 answer
49 views

I moved a library for stock market analysis to the cloud and found strange performance with a key pandas function. It runs reasonably quickly on my low-performance Dell XPS laptop and exhibits ...
David R's user avatar
  • 1,044
2 votes
0 answers
75 views

This may be similar to bottleneck.move_mean get different result for the same ndarray, but that 'question' was ill-posed and so attracted no answers. I have found that for a single array, bottleneck ...
Mike's user avatar
  • 67
0 votes
2 answers
76 views

I need help with this code, My purpose is to show multiple Message one after one, this one is working fine but I need several messages to be shown one after one, I tryied different Method but allways ...
Agili Dt's user avatar
3 votes
2 answers
203 views

The goal is to compute a rolling average over 5-minute windows using Polars, where: the window ends at each timestamp t the left edge of the window is not strict — if there are no values exactly at t ...
Mike Church's user avatar
3 votes
2 answers
85 views

I have some data with a timestamp column t, an event category column cat, and a user_id column. cat can take n values, including value A. I want to select records which are followed (not necessarily ...
Max Davy's user avatar
0 votes
2 answers
129 views

I am trying to write a function to compute the rolling Median Absolute Deviation (MAD) for outlier detection in a time series dataset. The goal is to: Detect outliers based on a rolling MAD algorithm ...
user2845095's user avatar
0 votes
1 answer
98 views

I have a dataset with daily data with the following structure (with many firms and for a very long time frame) in R: date month_id company_id value 2024-01-02 1 1 2 2024-...
datgoaltho's user avatar
2 votes
1 answer
110 views

I'd like to analyse time-series data along multiple rolling windows. As a first step, I'd like to extract the start and end-times of said windows. Sadly, using zoo:rollapply seems to be missing a ...
Beres's user avatar
  • 177
1 vote
1 answer
91 views

Suppose I have below dataset: date Value 01-Jul-24 37 01-Aug-24 76 01-Sep-24 25 01-Oct-24 85 01-Nov-24 27 01-Dec-24 28 And I want to aggregate by 3 months rolling:...
ccgg's user avatar
  • 13
2 votes
2 answers
92 views

I need to group by multiple columns on a dataframe and calculate the rolling mean in the group. But the original index needs to be preserved. Simple python code below : data = {'values': [1,2,3,4,5,6,...
Don Woodward's user avatar
1 vote
0 answers
53 views

I have an Appointments table with the columns MemberID and DateOfConsultation. Each member may have more than 1 consultation, with the same or different dates. I want to get a rolling 3 month period, ...
Pedro Laginha's user avatar
4 votes
1 answer
115 views

Similar question is asked here However it didn't seem to work in my case. I have a dataframe with 3 columns, date, groups, prob. What I want is to create a 3 day rolling mean of the prob column values ...
AColoredReptile's user avatar
5 votes
2 answers
170 views

I have a DataFrame like this: import polars as pl df = pl.DataFrame({"x": [1.2, 1.3, 3.4, 3.5]}) df # shape: (3, 1) # ┌─────┐ # │ a │ # │ --- │ # │ f64 │ # ╞═════╡ # │ 1.2 │ # │ 1.3 │ # │...
bretauv's user avatar
  • 8,885
2 votes
1 answer
76 views

I have a dataset of messages being sent between two people (user A and user B) on different chats over time. I need to figure out how to track the datetime of the last but earliest user A message ...
rastrast's user avatar
  • 327
2 votes
2 answers
73 views

I have a dataset of messages being sent between two people (user A and user B) on different chats over time. I need to figure out how to track the datetime of the last, most recent user A message ...
rastrast's user avatar
  • 327
3 votes
1 answer
112 views

Is there an efficient algo for Rolling Absolute Median Deviation (MAD)? The Moving Window sliding over the Array X, and computing MAD for every array item. It's possible to efficiently compute Rolling ...
Alex Craft's user avatar
  • 15.8k
0 votes
0 answers
21 views

I have a series of json files. Each file has the information for the last 30 days. Within each file, the data is broken down by date. So for example, File_Mar31 has data for Mar 1 - Mar 30 (broken ...
JakeUT's user avatar
  • 567
0 votes
0 answers
29 views

I'm trying to find how the "50D" rolling mean is being calculated in the following example because really I cannot find the way. import pandas as pd values = [np.nan, -0.00076194, -0....
Armando Contestabile's user avatar
4 votes
1 answer
474 views

I'd like to perform the following: Input: import polars as pl df = pl.DataFrame({ "a": [1,15,None,20,None] }) Output: expected = pl.from_repr(""" ┌──────┬──────┐ │ a ┆...
user24758287's user avatar
1 vote
1 answer
82 views

Just curious why the Pandas Series rolling window method doesn't preserve the data-type of the original series: import numpy as np import pandas as pd x = pd.Series(np.ones(6), dtype='float32') x....
Bill's user avatar
  • 11.8k
0 votes
0 answers
66 views

We have a dataframe indexed by time with identifier id_col, a group columns group_col and value_col="value". The value_col is updated at random intervals with different frequencies per ...
flT's user avatar
  • 131
0 votes
2 answers
215 views

I have a scenario where I need to calculate a running total using the SUM window function in SQL. The issue arises because some rows have duplicate timestamps, and the RANGE clause in the window ...
Saurabh Ghadge's user avatar
1 vote
1 answer
39 views

I have tried to find the solution to this but havent been able to. So asking. I have a dataset for which I wish to forecast values for future dates for groups within the dataset. The goal would be to ...
abatra's user avatar
  • 11
1 vote
1 answer
43 views

I’m relatively new to Python and coding in general. I’m working on a project to perform persistence analysis in a large dataset and am trying to avoid using for loops for efficiency. I’d appreciate ...
jr09045's user avatar
  • 11
0 votes
2 answers
38 views

I have a data frame below, would like to add a column call Percentage. Sort by each Trade In CofQYr == 0 row, Percentage would be row Sum across all columns (from 2014 5o 2024) divide by the row sum ...
user15032839's user avatar
0 votes
2 answers
55 views

data = {‘A’:list(range(250)), ‘B’: list(range(251,501))} dates = pd.date_range(‘2023-01-17’, period=250, freq=‘D’) df = pd.DataFrame(data, index=dates) I want rolling 2 calendar month mean as follows:...
Gerry's user avatar
  • 636
0 votes
1 answer
43 views

I have this time serie: var numNames = new SeriesBuilder<int, string>() { { 1, "one" }, { 2, "two" },{ 3, "three" }, { 4, "four" }, { 5, "five"...
mhern0749's user avatar
-1 votes
1 answer
102 views

I have this table in SQL server : date var val 2022-2-1 A 1.1 2022-3-1 A 2.3 2022-4-1 A 1.5 2022-5-1 A 1.7 2022-09-1 B 1.8 2022-10-1 B 1.9 2022-11-1 B 2.1 2022-12-1 B 2.22 I want to group by column ...
Homer Jay Simpson's user avatar
2 votes
2 answers
113 views

I would like to have a new column with the most frequent rolling value from another str/object column. date name state 0 2024-02-29 Alice CA 1 2024-02-27 Bob HI 2 ...
lolo's user avatar
  • 79
1 vote
1 answer
58 views

I have one data set consisting of a total of 16 data (quarterly data from 2012 to 2015) as sample data set. I want to predict the 15th data (3rd quarter of 2015) from the model learned with an arima ...
유준택's user avatar
3 votes
2 answers
220 views

My question is whether there is a way to have null until the full window can be filled at the start of a rolling window in polars. For example: dates = [ "2020-01-01", "2020-01-...
AColoredReptile's user avatar
3 votes
1 answer
101 views

I have a ~100M rows long data frame containing IDs in different groups. Some of them are wrong (indicated by the 99). I am trying to correct them with a rolling mode window, similar to the code ...
usdn's user avatar
  • 514
4 votes
1 answer
187 views

My data are at the ID-month level with a payment at every month. It is sorted by id and dt. What I'd like to do is a create a new column that, for each group, holds the linear slope for the next N ...
kstats9pt3's user avatar
2 votes
2 answers
143 views

In a number of aggregation function, such as rolling_mean, rolling_max, rolling_min, etc, the input argument window_size is supposed to be of type int I am wondering how to efficiently compute results ...
Andi's user avatar
  • 5,177
0 votes
1 answer
79 views

I have a time series of half-hourly observations. I want a running average of the range of each day's measurements. I group by date and get the correct daily ranges, but then everything I can think ...
uhClem's user avatar
  • 147
0 votes
1 answer
71 views

I have a dataframe of 2 asset prices and the Z score of their ratio (A/B) and am trying to do a simple backtest with signal generation of a pairs ratio trade of entering when Z score < -2 (long ...
Anonymous's user avatar
4 votes
1 answer
83 views

How to add rolling KPI's to original dataframe in polars? when I do group by, I am not seeing an index and so cant join? I want to keep all original columns in dataframe intact but add rolling kpi to ...
r ram's user avatar
  • 290
1 vote
1 answer
78 views

My function call looks something like loss = log_loss(y_true=validate_d['y'], y_pred=validate_probs, sample_weight=validate_df['weight'], normalize=True) Is there any way to combine this with pandas ...
Baron Yugovich's user avatar
0 votes
1 answer
32 views

On this SQLBI video rolling average doesnt calculate anything to totals row? Why is that? Would like to have snapshot value also for rolling value on card etc https://www.youtube.com/watch?v=...
jansse's user avatar
  • 45
0 votes
1 answer
139 views

I tried to calculate a 5 Year Moving Average of Exchange Rate in R but I can't get the code to work properly. I want to calculate a Moving Average similar to Atlas Conversion Factor used by World Bank ...
Anon9001's user avatar
2 votes
1 answer
231 views

See the code below, it's a stand-in for what I need. ChatGPT and perplexity aren't helpful here. In practice I can compute col1 and col2 one at a time, but it is unnecessarily slow. import numpy as np ...
Mefitico's user avatar
  • 1,176
0 votes
1 answer
65 views

I want to consider a window of size 3, in which I take the last value from the b column, and the other 2 values from the a column, like in this example: df = pd.DataFrame.from_dict({'a':[1, 2, 3, 4, 5]...
Baron Yugovich's user avatar
1 vote
1 answer
49 views

Background I have a dataframe of stock prices with close price, day high, day low prices and am trying to backtest potential short sell entries. The logic is if there has been any 30% downwards ...
Anonymous's user avatar
1 vote
1 answer
82 views

This is what I am trying to accomplish codelink I want a rolling percent for a rolling year that looks back either 365 days or 11 months, I am just not sure how the frames work. If a hover over a ...
alittleloopy's user avatar
6 votes
3 answers
806 views

Using polars .rolling and .agg, how do I get the original column back, without having to join back with the original column, or without having to use .over? Example: import polars as pl dates = [ ...
Olivier_s_j's user avatar
  • 5,232
0 votes
1 answer
192 views

I am trying to implement a sliding window regression to predict stock prices and I realized I didn't understand how sliding window regression works for prediction. I have some training data (the ...
Dan1618's user avatar
  • 101

1
2 3 4 5
24