Python Forum
Convert quarterly time series to monthly time series
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Convert quarterly time series to monthly time series
#1
Hi,

in order to bring all my data sets in the same shape, I need to convert a data set consisting of quartlery dates into a data set consisting of monthly dates. Here is a sample :

Date Feature
2000/03 1.1
2000/06 0.9
2000/09 0.5
2000/12 0.6

What I would like to have is:

Date Feature
2000/01 1.1
2000/02 1.1
2000/03 1.1
2000/04 0.9
2000/05 0.9
2000/06 0.9

Moreover, in order to get more accurate values for each month, I need the data to be interpolated. Any hint how I could do that? thanks in advance!

Edit : Sorry i could not figure out proper formatting, and thus it looks a little bit ugly

If anyone encounters the same problem, here is the solution :

For resampling :
dataframe = dataframe.resample('1M').mean()

1M can changed to D ( Days ) aswell, mean() fills the "empty" values with the mean

For interpolation :
dataframe['Column'] = dataframe[['Column')].interpolate(method="linear")

other interpolation methods exist, like polynomial and so on
Reply
#2
Please use proper code tags while posting a thread. See BBCode
pyzyx3qwerty
"The greatest glory in living lies not in never falling, but in rising every time we fall." - Nelson Mandela
Need help on the forum? Visit help @ python forum
For learning more and more about python, visit Python docs
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Date Time Series Help...Please spra8560 2 312 Feb-01-2024, 01:38 PM
Last Post: spra8560
  Python date format changes to date & time 1418 4 513 Jan-20-2024, 04:45 AM
Last Post: 1418
  time difference bettwenn logs enkliy 14 873 Nov-21-2023, 04:51 PM
Last Post: rob101
Question Need Help with Vehicle Routing Problem with Time Windows (VRPTW) in Python kasper321421312 1 502 Nov-10-2023, 08:19 PM
Last Post: snippsat
  find the sum of a series of values that equal a number ancorte 1 461 Oct-30-2023, 05:41 AM
Last Post: Gribouillis
  How do I stream and record at the same time with arducam? traderjoe 0 430 Oct-23-2023, 12:01 AM
Last Post: traderjoe
  i tried to install python for the first time today and pretty certain im being remote brianlj 2 505 Oct-03-2023, 11:15 AM
Last Post: snippsat
  [Python 2.7] Why can't I press [ESC] a fourth time? Ashwood 3 621 Aug-27-2023, 02:01 PM
Last Post: deanhystad
  Hard time trying to figure out the difference between two strings carecavoador 2 644 Aug-16-2023, 04:53 PM
Last Post: carecavoador
  return next item each time a function is executed User3000 19 2,163 Aug-06-2023, 02:29 PM
Last Post: deanhystad

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020