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
1 answer
Pandas interpolate is filling nan rather than interpolating
I have a dataframe, which is resampled to higher sampling rate like from 8hz to 16 hz.using
new_df = new_df.resample('62.5L').ffill()
instead of using ffill(), I tried to interpolate values using
interpolated = new_df.interpolate(method='linear',…

user5349
- 123
- 7
0
votes
0 answers
Select data, resample and join horizontally in Python
I have two dataframes df1 and df2.
df1:
Id Date Remark
0 28 2010-04-08 xx
1 29 2010-10-10 yy
2 30 2012-12-03 zz
3 31 2010-03-16 aa
df2:
Id Timestamp Value Site
0 28 2010-04-08…

nilsinelabore
- 4,143
- 17
- 65
- 122
0
votes
0 answers
Pandas resample always throws Exception
I'm having a hard time getting Pandas resample to work.
I don't want to set a datetime index but want to use a column with the dates.
As I understood this should be possible. (When using a datetime index it does work)
this is my code:
import pandas…

Phil K.
- 53
- 5
0
votes
2 answers
resampling and appending to same dataframe
I have a dataframe which I want to resample and append the results to original dataframe as new column,
What I have:
index = pd.date_range('1/1/2000', periods=9, freq='T')
series = pd.Series(range(9), index=index)
series
time value …

Phoenix
- 359
- 7
- 15
0
votes
1 answer
Manipulating columns and rows
def Resample_10mins(df, ZTD_station):
# ensure the time column is in the right format
df['Date'] = pd.to_datetime(df.Date)
# round to the nearest 10 minute interval
# if you want to floor / ceil the time, you may use
#`dt.floor` or `dt.ceil`…

Sandy Chkeir
- 3
- 2
0
votes
1 answer
How to calculate churn based on customer ID / emails?
I'm trying to calculate customer churn on a monthly basis using the following data. However, unfortunately I do not have a boolean value which takes the value 1/True or 0/False when customers churned or not. You can assume that when a customer…

PeterPost
- 1
- 1
0
votes
2 answers
how to fill the missing values where start date has been first day of month?
i have dataframe like this:
tst=
Date % on Merchant % on Customer Merchants Location
2021-08-04 0.0 0.10 Zwarma - The Shawarma Maker Palani
2021-08-05 0.0 0.10 Zwarma - The Shawarma Maker Palani
2021-08-06 0.0 0.10 …

Vamshi Krishna
- 1
- 2
0
votes
1 answer
finding a 15minutes with highest value in 10 years in pandas
I have a dataframe with 15minutes observations for 10 years.
I want to find the 15minutes that has often the highest value over the years.
time_start count_id location_id obs
time
2000-03-07 07:30:00 2000-03-07 07:30:00-05:00 …

GeoBeez
- 920
- 2
- 12
- 20
0
votes
1 answer
resample a non-continuous 15-minutes data to an hourly groupped data in pandas
I have a dataframe of 20-years of precipitation for 5 stations. The observations are non-continuously 15minutes collected for 8-hours a day. I want to find the station and the day that the total 8hours (7am to 10am, 13 to 14, and 16pm to 17pm) of…

GeoBeez
- 920
- 2
- 12
- 20
0
votes
1 answer
Pandas resample changes dates
Why is df.resample() changing the dates when I resample?
X
What I want this to do is insert one row with index '2014-07-01' and value NaN.
X.resample('12M').last()
`

Mose Wintner
- 290
- 1
- 10
0
votes
0 answers
pandas.core.base.SpecificationError - Resample
Code:
from __future__ import(absolute_import, division, print_function, unicode_literals)
import backtrader as bt
from datetime import datetime, timedelta
import pandas as pd
import csv
import numpy as np
import math
csvframe =…

Vinodh
- 1
0
votes
1 answer
Pandas resample from daily to monthly using original datetime index
I have daily OHLC stock data.
open high low close
date
1980-01-04 491.8 491.8 491.8 491.8
1980-01-07 492.5 492.5 492.5 492.5
1980-01-08 494.1 494.1 494.1 494.1
1980-01-09 498.0 498.0…

Andi
- 3,196
- 2
- 24
- 44
0
votes
1 answer
Faster Resampling Daily Covariance Matrix (MultiIndex) from Daily to Minutely
I looked at similar answers but could not find one that suits my problem.
I have a daily covariance matrix that is constructed as a MultiIndex. It has "k" dates, and for each date "k" it has a matrix of size "n" by "n". The dimensions are…

The User
- 55
- 3
- 11
0
votes
1 answer
Pandas resampling data and getting the mean
I'm trying to resample some data in 1 minute intervals and use the mean average to represent that minute of data, but I keep getting an error:
DataError: No numeric types to aggregate.
if I try min() ,max() or sum() it works fine but not with…

Riyad
- 1
- 2
0
votes
2 answers
how to count value in a dataframe column based on filtering
Given this dataframe :
DriverId time SPEED
0 2021-04-16 21:40:00+00:00 58.500000
2021-04-16 21:41:00+00:00 32.850000
2021-04-16 21:42:00+00:00 89.633333
2021-04-16…

girl_of_data
- 45
- 8