Relating to up- or down-sampling time series data in the Python package pandas, specifically the methods pandas.DataFrame.resample() and pandas.Series.resample().
Questions tagged [pandas-resample]
314 questions
0
votes
0 answers
How to speed up resample with for loop?
I want to get the value of rsi on h1 for each m15 candle, this is how I do this. However, with data larger than 500000 lines, this is very time consuming, is there any better way. Note that it is mandatory to resample each row to get the correct…
0
votes
0 answers
Error while resampling from daily to monthly frequency
I have a csv data with daily frequency as shown below:
d = pd.read_csv("DGS5.csv")
d['DATE'] = pd.to_datetime(d.DATE)
d.set_index('DATE', inplace=True)
print(d)
DGS5
DATE
1962-01-02 3.88
1962-01-03 3.87
1962-01-04 …

sam
- 71
- 1
- 3
- 14
0
votes
1 answer
How to seperate dataframe in group with a five minutes interval?
I have a dataframe like this:
timestamp
id
data1
2022-12-12 10:03:02
a1
x1
2022-12-12 10:03:02
a2
c1
2022-12-12 10:04:12
a1
x2
2022-12-12 10:04:12
a2
c2
2022-12-12 10:05:02
a1
x3
2022-12-12 10:05:02
a2
c3
2022-12-12…

user398843
- 159
- 8
0
votes
2 answers
Using .resemple() in python to go from weekly to monthly time series
Is it possible to use .resample() to take the last observation in a month of a weekly time series to create a monthly time series from the weekly time series? I don't want to sum or average anything, just take the last observation of each…

Yago
- 63
- 5
0
votes
0 answers
How to include columns with strings in Pandas resample
I have daily data from capital trades and I would like to resample and get the weekly value of buys and sells for each stock
here is the data
I have tried
df = trades.set_index("Date")
# df.index = df.index -…

Denis Mwaniki
- 1
- 2
0
votes
1 answer
How to use the resampling function to create 23 hour average data
I want to make an average every 23 hours from 10:00 a.m to 9:00 a.m. the next day.
but i can't find solution
newDf = Data_s.resample(rule='H').mean()
I think I can change this code, but I don't know how.
My data are divided from March 11th to April…

ARMIR
- 1
- 1
0
votes
0 answers
Replicate pandas quarterly resample with monthly resample
Is there a way to replicate df.resample('QS') using monthly resample?
For example
index = pd.date_range('1/2/2000', periods=11, freq='MS')
series = pd.Series(range(11), index=index)
series.resample('QS').sum()
Gives me
2000-01-01 1
2000-04-01 …

montoisky
- 133
- 1
- 6
0
votes
2 answers
Pandas resample drops (static) datetime column, how do I keep it?
I'm working with a pandas Multiindex that is given by the three keys:
[Verbundzuordnung, ProjektIndex, Datum],
I would like to resample the dataframe on Datum hourly, which drops the right colum TagDesAbdichtens, I would like to keep it as it's…

Krotonix
- 25
- 5
0
votes
0 answers
Python: Forward fill values of a multiindex DataFrame on a daily, monthly and quarterly basis based on the value of first level index
I have a multiindex DataFrame with level=0 being the date and level=1 being the stock index, and the columns being the constituent tickers of each stock index. The values are tallies recording when the ticker is in the index (1.0) and when it's not…

MathMan 99
- 665
- 1
- 7
- 19
0
votes
1 answer
Averaging the data across two calendar years and defining the beginning month
I have a data for a period from December 2013 to November 2018. I converted it into a data frame as shown here.
Date 0.1 0.2 0.3 0.4 0.5 0.6
2013-12-01 301.04 297.4 296.63 295.76 295.25 295.25
2013-12-04 297.96 297.15 296.25 …

Santos
- 3
- 4
0
votes
1 answer
mininum value of a resample (not 0)
i have a dataframe (df) indexed by dates (freq: 15 minutes): (little example)
datetime
Value
2019-09-02 16:15:00
0.00
2019-09-02 16:30:00
3.07
2019-09-02 16:45:00
1.05
And i want to resample my dataframe to freq: 1 month. Also I need…

ALbertittor
- 163
- 1
- 1
- 5
0
votes
1 answer
frontfill or backfill of STRING column at resample() in pandas
is there any methode while doing resampling() to ffill() or bfill() a object column?
Suppose we have:
Date
Sort
Value
2022-10-23 15:40:41
A
1
2022-10-23 18:43:13
B
2
2022-10-24 15:40:41
C
3
2022-10-24 18:43:13
D
4
i would like to…

Mischbot
- 3
- 2
0
votes
0 answers
Resample().mean() in Python/Pandas and adding the results to my dataframe when the starting point is missing
I'm pretty new to coding and have a problem resampling my dataframe with Pandas. I need to resample my data ("value") to means for every 10 minutes (13:30, 13:40, etc.). The problem is: The data start around 13:36 and I can't access them by hand…

Leni
- 1
- 2
0
votes
0 answers
Overlaying running sum plot over historgram plot in Python
I have daily time-series (named as fname (14245 rows × 15 columns) in my code) dataframe as shown in the image that I needed to count the number of days with value greater than 0. For example, number of days when ext2d_1_dates greater than 0 to get…

hilorywilsmart
- 7
- 3
0
votes
1 answer
Avoid DataFrame.resample to change the hour
I am trying to extract the minimum value for each day in a dataset containing hourly prices. This I want to do for every hour separately since I later want to add other information to each hour, before combining the dataset again (which is why I…
user20050294