Questions tagged [resample]

70 questions
2
votes
2 answers

How to perform nested resampling in R - Diversity index uncertainty

I'm currently trying to apply the resampling method described in Herrmann et al. (2022) with an outer and an inner resampling loop : My dataset is composed of 100 rows by 60 columns. Rows correspond to tries ID (one try per row) and columns to…
2
votes
1 answer

Pandas - group rows on date condition

I have the following dataframe... date_time day value1 value2 0 2023-03-15 00:00:00 3 1 1 1 2023-03-15 06:00:00 3 2 2 2 2023-03-15 12:00:00 3 3 3 3 2023-03-15 18:00:00 3 4 …
2
votes
1 answer

Difference between pandas resample 'M' and 'MS'

I'm using the function resample to change the daily data to be a monthly data of a pandas dataframe. Reading the documentation I found that I could define the rule='M' or rule='MS'. The first is "calendar month end" and the second is "calendar month…
Arrigo
  • 21
  • 1
  • 3
1
vote
1 answer

python all resample the whole row no matter it is null or numeric value

I have a series, pd.Series( [6.22, 6.23, 6.23, 6.24, 6.24, 6.25, np.nan, np.nan, np.nan, np.nan], index = pd.DatetimeIndex(['2023-08-01 10:31:40.110000', '2023-08-01 10:31:43.110000', '2023-08-01 10:31:46.111000', '2023-08-01…
tesla1060
  • 2,621
  • 6
  • 31
  • 43
1
vote
2 answers

Count minutes per day over index

I have a dataframe with irregular timestamps in seconds that spans over multiple days, I would like to create a new column and bucket these entries in minute buckets and have an increasing counter in a separate column. So all values that are within…
ThatQuantDude
  • 759
  • 1
  • 9
  • 26
1
vote
1 answer

mlr3 standard deviation for k-fold cross-validation resampling

Anybody know how to extract the standard deviation for a ResampleResult/BenchmarkResult in mlr3? The implemented metrics seems to be returning only the average value. measures <- list( mlr3::msr("classif.fbeta", predict_sets = "train", id =…
1
vote
2 answers

Using Pandas, generate weekly open, high, low, close and simple moving average of Close for each day in historical data

From daily stock OHLC data as under, Date                      Daily Open          Daily High            Daily Low             Daily Close 31-Oct-22            17910.2                 18022.8                 17899.9                …
X Y
  • 23
  • 3
1
vote
2 answers

Monthly averages to daily granularity

I have a dataframe which is monthly averages which looks like the following; A B C D E 1 3 21 3 22 3 2 4 32 3 24 0 3 5 1 12 3 12 . . 11 5 4 9 85 85 3 12 43 4 48 3 84 4 I'm looking to convert this data to a daily…
spcol
  • 437
  • 4
  • 15
1
vote
1 answer

Resample netCDF per month across years

I have a monthly mean precipitation netCDF file that covers a period of five years. The specifics of the file are: Dimensions: (time: 60, rlat: 412, rlon: 424) Coordinates: lat (rlat, rlon) float64 21.99 22.03 22.07 22.11…
1
vote
1 answer

Pandas resample: How to get resampled values from inexact timestamps

I have a dataframe with data that I obtained from a device, so that timestamp is not at exact seconds. Like below: hr …
1
vote
1 answer

xarray temporal averaging only if time period has minimum amount of samples

I'm resampling a daily xarray dataset into monthly values. Is there a straightforward way to output NaN when for example only 50 percent of the days have valid data? In the moment I'm using the xarray standard function which will output a monthly…
dr226
  • 11
  • 1
1
vote
1 answer

Pandas resampling data with bigger interval than a whole index range

Situation I have the folowwing pandas timeseries data: date predicted1 2001-03-13 0.994756 2005-08-22 0.551661 2000-05-07 0.001396 I need to take into account a case of resampling into bigger interval than a 5 years, for e.g. 10…
1
vote
1 answer

How to exclude working days in df.sample?

I have a df like this: import pandas as pd import numpy as np df = pd.DataFrame(np.random.randn(100, 2),columns=['A', 'B']) df['Date'] = pd.date_range("1/1/2000", periods=100) df.set_index('Date', inplace = True) I want to resample it by week and…
1
vote
1 answer

Getting the mean per hour of a dataframe (for daily data) using python given a number of observations taken within an hour

I have the following sample data: DATE TIMEREAD LEVEL 09/07/2013 12:30:12 5 09/07/2013 12:40:07 2 09/07/2013 12:50:09 5 10/07/2013 01:05:58 3 10/07/2013 01:25:15 2 11/07/2013 15:05:10 …
kiwi_kimchi
  • 345
  • 3
  • 12
1
vote
1 answer

PANDAS - Resample monthly time series to hourly

Suppose I have a multi-index Pandas data frame with two index levels: month_begin and month_end import pandas as pd multi_index = pd.MultiIndex.from_tuples([("2022-03-01", "2022-03-31"), ("2022-04-01",…
W. Walter
  • 337
  • 1
  • 10
1
2 3 4 5