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 do I resample a Dataframe with average weighting each value on a time ratio until next value according to the Dateframe's Datetime index?
How can I resample a Dataframe's column, that has float values, with the average, of the values within the resampling period, weighting each value on the ratio of:
time that, according to the Dateframe's Datetime index, goes by until reaching the…

goahead97
- 65
- 8
0
votes
0 answers
Pandas resampling method
I am trying to resample a time series to get annual maximum values for different time steps(eg., 3h, 6h, etc. The original series is at an hourly resolution. I first converted the date format to pandas date format, used that column as an index, and…

Dawar
- 69
- 8
0
votes
0 answers
Python Pandas: Resample: Adjust start and end date
I have monthly data from 1989/09 to 2020/12 and want to convert it to weekly data (friday to friday) starting 1989/09/29 to 2020/12/25 and just keep the values for the months in the weekly data (e.g. for all weeks in september the value for…

Max N
- 21
- 4
0
votes
1 answer
Converting Annual and Monthly data to weekly in Python
My current data has variables recorded at different time interval and I want to have all variables cleaned and nicely aligned in a weekly format by either redistribution (weekly = monthly/4) or fill in the monthly value for each week (weekly =…

riostrich
- 1
- 1
0
votes
0 answers
pandas limited resample / windowed replacing of multiple rows of values
I am working with weather data for PV modules. The irradiance dataset (regular timeseries, 1 second data) I've been given shows an issue that occurs often in this field: occasionally, a zero value shows up when it shouldn't (daytime), e.g. due to an…

Monte Cristo
- 131
- 1
- 12
0
votes
2 answers
Pandas resample without aggregation
I have tried a lot to found a method that allow me to obtain all the groups of a resampling or of a group by without any aggregation for example starting from:
import pandas as pd
import datetime
import numpy as…

mat
- 181
- 14
0
votes
2 answers
Finding the average of the unequal values per month and distribute it based on some conditions
I am currently struggling with converting my data into a useful dataset. I need to evenly distribute payments from the first month up to the last month. The problem is that payments are inconsistent and unequal. Also, there are payments that have…

Yam
- 165
- 12
0
votes
1 answer
How to resample a grouped dataframe with zero order hold?
I have a dataframe with a bunch of different measurements (each have a unique ID in a measurements column), and measurement samples taken each 10ms.
Now I want to downsample all my data in order to "fake" a different sampling time, e.g. 40ms, for…

Rejaho
- 1
- 1
0
votes
1 answer
Pandas: How to get last daily value for each item in one column and subtract it from the value in each row
Consider the following data frame with a timestamp index which may have repeated (i.e. non-unique) index values, another column that indicates the asset, and another column with the value of that asset at that timestamp.
df
…

finstats
- 1,349
- 4
- 19
- 31
0
votes
1 answer
Groupby and resample using forward and backward fill in window in Python
I want to resample data column using forward fill ffill and backward fill bfill at the frequency of 1min while grouping df by id column.
df:
id timestamp data
1 1 2017-01-02 13:14:53.040 10.0
2 1 …

nilsinelabore
- 4,143
- 17
- 65
- 122
0
votes
2 answers
Python - calculate de total amount or sells each month
I have a dataframe with several OrderId, Date of sale, product taht was sale and so on.
I am currently trying to calculate the month in which were sold less Motorcycles.
This is the code I wrote, trying with group by to calculate the total amount…

icatalan
- 101
- 2
- 10
0
votes
1 answer
Upsampling minute to second
I have a dataframe which contains a datetime column like this:
As you see in the "date_time" column the smallest time unit is minute. In fact, it does not have second uinte. I mean, for example, in the first six rows, 4:24 is repeated which means…

Asa Ya
- 61
- 1
- 7
0
votes
0 answers
Merging pandas time series dataframes with differing time resolutions
I have two dataframes of data each of which has datetime index. One of the datasets has a time resolution of 12.33 minutes, here df1, and the other has a time resolution of 1 second, here called df2:
np.random.seed(seed=1111)
data =…

user1912925
- 781
- 1
- 11
- 25
0
votes
1 answer
How to discretize time series with overspilling durations?
I am trying to discretize my dataframe which looks like this:
Start Date
Park Duration (mins)
Charge Duration (mins)
Energy (kWh)
49698
2016-01-01 11:48:00
230
92.0
3.034643
49710
2016-01-01 13:43:00
225
225.0
12.427662
49732
2016-01-01…

Jungar
- 49
- 1
- 6
0
votes
1 answer
resample data within each group in pandas
I have a dataframe with different id and possible overlapping time with the time step of 0.4 second. I would like to resample the average speed for each id with the time step of 0.8 second.
time id speed
0 0.0 1 0
1 0.4 1 …

WZhao
- 303
- 4
- 12