Questions tagged [resample]

70 questions
0
votes
0 answers

changing spacing of a dicom image using resample function of simpleITK

I'm trying to change the spacing of a 2D dicom image to that of 3D dicom volume.I realised that simply using the SetSpacing() function of the SimpleITK library won't do it and that I had to resample my 2D image in order to actually change the…
villich
  • 1
  • 1
0
votes
1 answer

Resampling Data from a netCDF File

I am very new to python and am working on the Jupyter notebook. I Have the following packages imported: import warnings import numpy as np import xarray as xr import pandas as pd import matplotlib.pyplot as plt import cartopy.crs as ccrs import…
0
votes
1 answer

Pandas Resample Not Returning 'on=' column in aggregate

I have three pandas Dataframe with 3 features: Date In, Date Out, Status Date In/Out are timestamps. Status is a text field. I want to know how many came in on every month and how many that went out in the same month. I used: d = df.resample('M',…
eatkimchi
  • 13
  • 3
0
votes
1 answer

How can I use rsample for multiple mrl algorithms?

I have some difficulty using the function resample of mlr package, in my case for example. library(mlr) learners = makeLearners(cls = c("C50", "rpart","ada","naiveBayes"), type = "classif", predict.type = "prob") data_task = makeClassifTask(data =…
royer
  • 615
  • 1
  • 6
  • 19
0
votes
1 answer

Pandas Resample OHLC data Skipping time

I have a time series OHLC 1 min date. date,open,high,low,close,volume 2023-04-20 09:15:00+05:30,262.0,267.85,262.0,262.5,7300 2023-04-20 09:16:00+05:30,262.5,264.3,261.8,262.6,6300 2023-04-20 09:17:00+05:30,262.6,266.95,262.0,265.75,3600 2023-04-20…
Mintoo
  • 5
  • 1
  • 1
0
votes
1 answer

Resample pandas df with multiple groupbys so each condition has the same number of total days of data

I have been going round in circles with this and haven't been able to figure it out. Suppose I have the following dataframe: df = pd.DataFrame({ "person_id": ["1", "1", "1", "1", "2", "2", "2", "2", "3", "3", "3", "3"], "event": ["Alert1",…
Dr Wampa
  • 443
  • 3
  • 8
0
votes
1 answer

Pandas - group rows on date condition (part 2)

I recently asked a question regarding grouping pandas rows on a date condition, and got an excellent answer see here However, it got me thinking that if this functionality was placed into a common function, then there is a scenario where this would…
0
votes
1 answer

Resample multiindex dataframe from yearly to monthly

I have a multiindex dataframe with indexes date and id and I want to resample it as BM frequency. I am using the following code: df.set_index('date').groupby('id').resample('BM').asfreq().drop('id',axis=1) But for a given id it resampled till the…
0
votes
0 answers

Resampling by Date index

I have a DataFrame df like this: Date Close Symbol 0 2018-03-05 44.21 AAPL 1 2018-03-06 44.17 AAPL 2 2018-03-07 43.76 AAPL 3 2018-03-08 44.24 AAPL 4 2018-03-09 44.99 AAPL ... ... ... …
Ivan
  • 7,448
  • 14
  • 69
  • 134
0
votes
1 answer

python dataframe resample backward

I want to resample a pandas time series counting backwards. For example, let's set up a simple time series of 11 days: index = pd.date_range('01-01-2018 00:00:00', '01-11-2018 23:59:00', freq='1T') randint = np.random.randint(low=0, high=9,…
jad
  • 29
  • 3
0
votes
0 answers

How to set resample length in Block bootstrap in ARCH package - Python

I want to use the CircularBlockBootstrap() in the arch package, but I can't find a way to set the output length. My code snippet is below: from arch.bootstrap import CircularBlockBootstrap error_1y = forecast_1y - actual_1y # this is a series of…
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
1 answer

In a pyspark.sql.dataframe.Dataframe, how to resample the "TIMESTAMP" column to daily intervals, for each unique id in the "ID" column?

The title almost says it already. I have a pyspark.sql.dataframe.Dataframe with a "ID", "TIMESTAMP", "CONSUMPTION" and "TEMPERATURE" column. I need the "TIMESTAMP" column to be resampled to daily intervals (from 15min intervals) and the…
0
votes
1 answer

Pandas resample().apply() with custom function very slow

I have a pandas Series in business-day frequency, and I want to resample it to weekly frequency where I take the product of those 5 days in a week. Some dummy data: dates = pd.bdate_range('2000-01-01', '2022-12-31') s =…
data-monkey
  • 1,535
  • 3
  • 15
  • 24
0
votes
1 answer

Resampling a netCDF file with multiple bands in python

I have daily mean precipitation netCDF file that covers a period of five years. The specifics of the file are: Dimensions: (rlat: 412, rlon: 424, time: 1826, bnds: 2) Coordinates: lat (rlat, rlon) float64 ... lon …