Questions tagged [pandas-resample]

Relating to up- or down-sampling time series data in the Python package pandas, specifically the methods pandas.DataFrame.resample() and pandas.Series.resample().

314 questions
0
votes
1 answer

How to make quarters in Python using groupby() function?

I have the dataset of sales of cars in various cities in which I want to divide the dataset into city-wise quarter sales I tried the code but it didn't work. qu=df.groupby([(df.City),(df.index.year),(df.quarter)]).agg(['sum', 'count'])
0
votes
1 answer

Python/Dask: How to replicate the use of “.groupby('Asset').resample('2D').pad()” in dask?

How can I get the same result I`m getting on pandas on DASK? The objective is to have a uniform time interval for each group, replicating the last value until we have a new one. import pandas as pd import numpy as np import…
0
votes
2 answers

How to assign a fix value to all hour of a day in pandas

I have a half-hourly dataframe with two columns. I would like to take all the hours of a day, then do some calculation which returns one number and assign that to all half-hours of that day. Below is an example code: dates =…
Ress
  • 667
  • 1
  • 7
  • 24
0
votes
0 answers

Resampling multidimensional data series using all columns

Here's a hard one: (I think) I have a time series-indexed dataframe with multiple columns. I need to resample the data to be every minute and calculate some metric using the columns. The issue is, the values I want to calculate for each minute,…
Ozz
  • 79
  • 6
0
votes
1 answer

How do I reindex a pandas DataFrame while also resampling it and aggregating its data according to the new index?

1) I have the following 1-minute-frequency-data in a pandas DataFrame: 0 Open High Low Close Volume 2010-10-19 06:31:00 58.75 58.81 58.58 58.59 228125 2010-10-19 06:32:00 58.59 58.68 58.55 58.57 153303 2010-10-19…
pmse234
  • 15
  • 4
0
votes
1 answer

Resampling error with pandas dataframe datetime index

I am running a txt. file through python and trying to resample the data into daily averages. The txt. file contains text before the actual data set, so I read the file then deleted the first rows. The entire data set has ~3 million rows. Sample data…
kn2298
  • 49
  • 5
0
votes
0 answers

Pandas Dataframe.resample() does not overwrite DataFrame

I don't know why the resample function doesn't work properly. I'm trying to resample with the simplest example but the function does not overwrite the original dataframe. import pandas as pd index = pd.date_range('1/1/2019', periods=8,…
0
votes
0 answers

Pandas count by each month in a date range

What I need is to calculate a number of actions by every month in the period from '2014-03' to '2019-01' for each module from start. month_range = ['2014-03', '2014-04', '2014-05', '2014-06', '2014-07', '2018-10', …
0
votes
1 answer

resample time data from list data in pandas python

I have a list data like bellow which has 6 things in each element in list "timestamp , open , high , low , close, volume" ['1606470300000,244.25,244.25,244.00,244.00,489269', '1606470360000,244.05,244.30,244.00,244.15,452854', …
0
votes
0 answers

split data hourly in Pandas

I have data available as EndTime Duration PartsProduced StartTime 2020-09-03 00:14:51 2020-09-03 00:46:56 1925 9100.0 2020-09-03 00:53:09…
s_mj
  • 530
  • 11
  • 28
0
votes
2 answers

Pandas: resample categorical index data

Assume some measurement data (in reality given about every minute) named logData: import pandas as pd, numpy as np idxData = pd.to_datetime(['08:00', '08:15', '08:30', '08:45', '09:00']) logData = pd.DataFrame(np.array([1.0, 2.0, 3.0, 4.0, 5.0]),…
Pontis
  • 343
  • 3
  • 15
0
votes
1 answer

resample yearly to daily data with forward values

I have 2 dataframe (one df and on series). They look like this : ranking Date type 2009-12-31 AAB000001471 Q2 AAB000001513 Q1 AAB000002057 Q2 AAB000002164 Q2 AAB000003162 …
0
votes
1 answer

How to change pandas resampling on a UTC OHLC Time Series based on Daylight Saving

I have a 1-minute OHLC CSV file with date using UTC df = pd.read_csv('...', usecols=['Date','Open','High','Low','Close'], index_col=['Date'], parse_dates=['Date']) I am resampling it using: ohlc_head = {'Open':'first', 'High':'max',…
Adam
  • 3,872
  • 6
  • 36
  • 66
0
votes
2 answers

Groupby and ffill specified columns in Python

I want to sort values by id_, Code, Timestamp (since time order matters), then groupby d1 using id_ and Code, then forward fill using ffill for NaN for each group, on columns V1 and V2 only, while keeping other columns constant, and return the full…
nilsinelabore
  • 4,143
  • 17
  • 65
  • 122
0
votes
1 answer

How to select data for especific time intervals after using Pandas’ resample function?

I used Pandas’ resample function for calculating the sales of a list of proucts every 6 months. I used the resample function for ‘6M’ and using apply({“column-name”:”sum”}). Now I’d like to create a table with the sum of the sales for the first six…
Pablo
  • 167
  • 2
  • 9