timeseires data

seungsulee
Level 2
timeseires data

hello, im trying to handle my time series data in Equispaced timestamp.

My time series data's timestamp column name is 'DATE' and its format is string at first.

and format is like 20220202.

 

So, i used python recipe to change my data 20220202 to 2022-02-02.

After that, my 'DATE' col is changed string to date.

 

Problem is my data is like

20220101

20200102

20220104

You can see, 20220203 is missing.

 

So, i use python recipe again to fill this, but got a problem.

Could you tell my how can i fix my code?

-------

# -*- coding: utf-8 -*-
import dataiku
import pandas as pd, numpy as np
from dataiku import pandasutils as pdu

# Read recipe inputs
v03_drop_col = dataiku.Dataset("03_drop_col")
v03_drop_col_df = v03_drop_col.get_dataframe()


v04_timeseries_equl_df = v03_drop_col_df.resample('D')
v04_timeseries_equl_df = v03_drop_col_df


# Write recipe outputs
v04_timeseries_equl = dataiku.Dataset("04_timeseries_equl")
v04_timeseries_equl.write_with_schema(v04_timeseries_equl_df)

------------

The error said, 

<class 'TypeError'>: Only valid with DatetimeIndex, TimedeltaIndex or PeriodIndex, but got an instance of 'RangeIndex'

 

 

 

 

 

0 Kudos
1 Reply
Manuel
Dataiker Alumni

Hi,

Before you use any of the time series recipes, make use you first parse the dates from string into a proper Date column. Use the Parse Date processor in a prepare recipe. There is a more detailed explanation in this page, https://doc.dataiku.com/dss/latest/preparation/dates.html.

Then you should be able to use Time Series interpolation recipe to fill the missing dates in your data.

I hope this helps.

0 Kudos