Questions tagged [resample]

70 questions
0
votes
1 answer

Replicating Stata Command bsample, cluster(nr) into R

I am replicating a paper by Clément de Chaisemartin: Two-Way Fixed Effects Estimators with Heterogeneous Treatment Effects. I face a problem with Stata command bsample - Sampling with replacement. I cannot understand what bsample, cluster(nr) Stata…
0
votes
0 answers

Reasampling Timeseries data and plotting in Tkinter window

I tried to plot data in Tkinter window having 12000 rows of excel data. But after removing index for resampling the data i am unable to display matplotlib graph on Tkinter GUI. dp.index=pd.to_datetime(dp['Test…
saran
  • 1
  • 2
0
votes
2 answers

resample date end of month match with date from original dataframe

I have data that i want to resample use end of month based on original df but when i use df.resample('M').last(). the end of month date that i got is different from original df. see the asterix marks. 2005-12-31 should be >> 2005-12-29. any…
stvlam22
  • 63
  • 7
0
votes
2 answers

Capturing the Timestamp values from resampled DataFrame

Using the .resample() method yields a DataFrame with a DatetimeIndex and a frequency. Does anyone have an idea on how to iterate through the values of that DatetimeIndex ? df = pd.DataFrame( data=np.random.randint(0, 10, 100), …
pomseb
  • 11
  • 3
0
votes
2 answers

Fill monthly holes (time-series) in a pandas dataframe with several categories

I have a time-series in pandas with several products (id's: a, b, etc), but with monthly holes. I have to fill those holes. It may be with np.nan or any other constant. I tried groupby but I wasnt able. date id units 2022-01-01 a …
0
votes
1 answer

Resample creates NAs in R using Terra package

I am a beginner in R and have two rasters with different extents. I need to resample the rasters and I use terra package for this but the output is a raster with all NAs. Does anyone have any idea how to fix it? I found a similar post but the…
mbh
  • 3
  • 3
0
votes
1 answer

Dataframe Resample date value keeping 'prices'

here a sample my dataframe : date début € / mois enerc € / mois edf 0 2021-04-01 40.86 8.46 1 2021-04-10 40.86 8.46 2 2021-04-16 33.69 8.46 3 2021-06-10 33.69 8.46 4 2021-08-01 37.71 9.35 5 2021-08-10 37.74 …
BenjiBoy
  • 141
  • 7
0
votes
1 answer

Increase sample size for logistic regression

Is it possible to somehow increase the number of my sample size for a logistic regression. The red data dots are false cases and the green ones are true cases. I want to create more data (let's say 500 points) which are sampled from the data in the…
0
votes
0 answers

To make the letters in a document image appear clearly in canvas

I am displaying the color JPG image of A4 document on canvas. However, the letters of the image shown in canvas are not clear. Recently, I saw the content of image resample through javascript. Please help me with how to make the characters inside…
Puhahaho
  • 1
  • 2
0
votes
1 answer

Resample months to days in PySpark

I've got a DataFrame like this: +-------------------+-----------+-------------+ | months| type|summaoborotdt| +-------------------+-----------+-------------+ |2022-01-01 00:00:00| schet_21| 131329.55| |2022-01-01 00:00:00| …
0
votes
1 answer

How to resample data using the Snowpark API for Python

I am trying to resample some quarterly data in Snowflake into daily data using Snowpark, I have some code that accomplishes this in PySpark; however, it seems that the function "explode()" does not have support in Snowpark. # define function to…
Finn Formica
  • 86
  • 1
  • 7
0
votes
0 answers

pandas resample - issue with epoch and frequency

I'd like to get a time series with a fixed set of dates in the index. I thought that resample with freq and epoch='origin' will do the trick. It seems that I'm using this method in a wrong way. Here's an example that shows that epoch='origin' does…
Grzegorz Rut
  • 205
  • 1
  • 2
  • 8
0
votes
1 answer

pandas resample '3M' to JAN-MAR / APR-JUN /

I have a pandas datable as (showing only 2 lines as example, sorted by DATE_1 after some processing) DATE_1 DATE _ 2 DIFF 1175 2010-01-01 2010-11-16 320 1170 2010-05-19 2010-11-06 171 .... ... ... ... so the first date is…
Maurizio
  • 37
  • 5
0
votes
1 answer

Pandas replace daily observations by monthly mean

Suppose, I have a pandas Series with daily observations: pd_series = pd.Series(np.random.rand(26281), index = pd.date_range('2022-01-01', '2024-12-31', freq = 'H')) pd_series 2022-01-01 00:00:00 0.933746 2022-01-01 01:00:00 0.588907 2022-01-01…
W. Walter
  • 337
  • 1
  • 10
0
votes
0 answers

Resample error in pandas: resampled df not appearing

I want to resample a df from daily measurements to yearly measurements. I have set a DateTime as the index and tried to resample, but the av_df_130302A df doens't appear in my Variable exploreer and nothing happens. I am not sure what I am doing…
emma_kth
  • 25
  • 2