Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8324719
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T00:10:28+00:00 2026-06-09T00:10:28+00:00

I try to upsample daily TimeSeries values using the pandas resample function. When i’m

  • 0

I try to upsample daily TimeSeries values using the pandas resample function. When i’m upsampling a single day (2012-01-01) i expect the result to be the mean of the day considered for upsampling. The result should look like this:

2012-01-01   -0,285344
Freq: D

However, pandas returns two days like this:

2012-01-01   -0.412417
2012-01-02    0.127073
Freq: D

Is this a bug or a feature? If it is a feature how can i set the resample arguments to achieve my goal?

Thanks,
Thomas

Here is the full example:

In [66]: rng = date_range('1/1/2012', periods=24, freq='H')

In [67]: ts = Series(np.random.randn(len(rng)), index=rng)

In [68]: ts
Out[68]:
2012-01-01 00:00:00   -0.412417
2012-01-01 01:00:00    0.442482
2012-01-01 02:00:00    1.321009
2012-01-01 03:00:00    0.104408
2012-01-01 04:00:00    1.124611
2012-01-01 05:00:00   -1.041293
2012-01-01 06:00:00    1.194104
2012-01-01 07:00:00   -0.249706
2012-01-01 08:00:00    1.927320
2012-01-01 09:00:00   -0.828365
2012-01-01 10:00:00    0.163760
2012-01-01 11:00:00   -0.736053
2012-01-01 12:00:00   -0.323408
2012-01-01 13:00:00    1.478162
2012-01-01 14:00:00    1.449437
2012-01-01 15:00:00   -1.114443
2012-01-01 16:00:00   -0.003780
2012-01-01 17:00:00    0.554562
2012-01-01 18:00:00   -2.019614
2012-01-01 19:00:00    0.463484
2012-01-01 20:00:00    0.862818
2012-01-01 21:00:00   -1.280048
2012-01-01 22:00:00   -0.137987
2012-01-01 23:00:00   -0.428777
Freq: H

In [69]: ts.resample('D')
Out[69]:
2012-01-01   -0.412417
2012-01-02    0.127073
Freq: D
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T00:10:30+00:00Added an answer on June 9, 2026 at 12:10 am

    You could get the result you want by using the loffset and closed options.

    >>> ts.resample('D', how='mean', closed="left", loffset=datetime.timedelta(days=-1))
    2012-01-01    0.200299
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Try to find a global function, to get and to put the backgroundPosition-values, but
Try the following in python 2.6: newyear_2012 = datetime.date.fromtimestamp(1325419200) newyear.year # returns 2012 newyear.isocalendar()
Try as I might, I can't get a RegEx to exclude space or single
try { using (MapDataContainer ent = new MapDataContainer()) //is an autogen'd EF object {
try: c = db.cursor() c.execute(insert or replace into registrations values + (?, ?, datetime('now')),
Try this in chrome versus firefox/IE: var cancelPressed = false; function redirect() { //window.location
try to apply a patch and compile received warning message: <some_file>: In function '-[XXXXX
Try If functionmode = ADD Then SQLStr = INSERT INTO boatmast VALUES (' &
Try the following code: myListener = new Object(); myListener.onKeyUp = function() { if (Key.isDown(Key.CONTROL)
I try to write a matlab function that upsamples me a picture (matrix of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.