0

Continuous date table

Hi All,

I want to include a continuous date table in the model and I am looking for a function similar to Dates = CALENDAR(DATE(2019,01,01), Date(YEAR(TODAY()), 12, 31)) so that my date table will start on Jan 1, 2019 and will add dates automatically for each next year ...

Is there a similar function supported by Pyramid?

Thanks

1 reply

null
    • Senior Director of Product
    • Ian_Macdonald
    • 4 yrs ago
    • Reported - view

    Hi Olga,

    We are currently developing this feature for a future release, so keep your eye  on the product announcement forum for this in the coming months.

    In the meantime, you can use the Python source block and a very simple script to achieve what you want:

     

    The script consists of:

            import pandas as pd 
            times = pd.date_range('2012-10-01', periods=1000, freq='D')
            datesDF= times.to_frame(name='date')

    The pandas date_range() function has endless configuration options. In this case I have opted to give a start date, then how many time periods I want and their frequency, in this case 1,000 days. You can also give a start/end date and many options for frequency. You can see the full syntax details for the function here and the frequency options here.

    Walking through Python code, the first line imports the Pandas data manipulation library, the second line calls the date_range function and returns the values as an Index. The 3rd line converts the Index to a Data Frame which is how data is passed back to Pyramid.

    I've added a Time Intelligence Block to then materialize the date attributes for analysis:

     

    Hope that helps.

    Ian

Content aside

  • Status Answered
  • 4 yrs agoLast active
  • 1Replies
  • 25Views
  • 2 Following