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 8090129
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T19:37:09+00:00 2026-06-05T19:37:09+00:00

I am currently fighting to work with the reasmpling function from pandas 0.8.0b1. For

  • 0

I am currently fighting to work with the reasmpling function from pandas 0.8.0b1.

For example, when I try to aggregate (using ‘mean’) 10min values to monthly values, the function seems to use the last day of data from one month in the mean of the next month…

Here is an example with a simple time serie of 3 month of 10 minutes data with

  • january 2012 : all values = 1
  • february 2012 : all values = 2
  • march 2012 : all values = 3

The monthly means I get using df.resample(‘M’,how=’mean’) are :

Out[454]: 

0
2012-01-31  1.000000
2012-02-29  1.965757
2012-03-31  2.967966
2012-04-30  3.000000

but I would like to get something like:

0
2012-02-01  1.000000
2012-03-01  2.000000
2012-04-01  3.000000

Here is the code:

january = pd.date_range(pd.datetime(2012,1,1),pd.datetime(2012,1,31,23,50),freq='10min')
february = pd.date_range(pd.datetime(2012,2,1),pd.datetime(2012,2,29,23,50),freq='10min')
march = pd.date_range(pd.datetime(2012,3,1),pd.datetime(2012,3,31,23,50),freq='10min')
data_jan = np.zeros(size(january))+1
data_feb = np.zeros(size(february))+2
data_march = np.zeros(size(march))+3
df1 = pd.DataFrame(data_jan,index=january)
df2 = pd.DataFrame(data_feb,index=february)
df3 = pd.DataFrame(data_march,index=march)
df = pd.concat([df1,df2,df3])
df.resample('M',how='mean')

If now, I remove the last day by :

january = pd.date_range(pd.datetime(2012,1,1),pd.datetime(2012,1,31,00,00),freq='10min')
february = pd.date_range(pd.datetime(2012,2,1),pd.datetime(2012,2,29,00,00),freq='10min')
march = pd.date_range(pd.datetime(2012,3,1),pd.datetime(2012,3,31,00,00),freq='10min')

I get (nearly) what I want:

Out[474]: 
            0
2012-01-31  1
2012-02-29  2
2012-03-31  3

Could you help me ???? Is it a bug ???

  • 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-05T19:37:10+00:00Added an answer on June 5, 2026 at 7:37 pm

    This is indeed a bug, I have two issues for it:

    https://github.com/pydata/pandas/issues/1458

    https://github.com/pydata/pandas/issues/1471

    This should be fixed before pandas 0.8.0 is released. Note that this works correctly:

    In [15]: df.resample('M', kind='period')
    Out[15]: 
              0
    Jan-2012  1
    Feb-2012  2
    Mar-2012  3
    

    EDIT: Just fixed this in git master (both of the above reference issues have been closed)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm fighting with pointers :(. I try to make a function which do something
Currently I am doing mass deletes using variations of the following query: DELETE FROM
Currently I'm using the Jackson JSON Processor to write preference data and whatnot to
Currently playing about with KnockoutJS. Just trying to update an observable array from a
Currently i am consuming web service from android by the method SOAP.Here i need
Currently writing a C# application it should do backups using GIT in the background.
Currently using a MySQL database Wanting to insert a new row into a table
Currently using Chrome v19.0.1084.46 (Official Build 135956) beta-m jqGrid 4.3.2 (latest release) The problem
Currently I'm using an ArrayList to store a list of elements, whereby I will
I'm currently fighting with Vim, I can't seem to make the indentation options do

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.