Skip to content

BaseDatafier

BaseDatafier

Contains data preparation modules, which includes interpolation. data should be in this format where time is set to index

    Example:
    >>> time  col1 col2 col3 ...
    >>> 2012   1    0    2
    >>> 2013   2    3    1

Parameters:

Name Type Description Default
data pd.DataFrame

The data to be prepared, should be in this format where time is set to index

required
time_format str

Index datetime format

required
ip_freq str

Interpolation frequency

required

add_var(row_var=None, col_var=None)

Adds additional variables to the data, both row and column wise.

Row wise data format: The index should be equal to that of the actual data.

    time  leap_year col2   ...
    2012    yes      0
    2013    no       3
Column wise data format: The index should be equal to the columns of the actual data.
    index  continent   col2 ...
    ind    Asia         0
    usa    N America    3
    jap    Asia         2

Parameters:

Name Type Description Default
row_var pd.DataFrame

Dataframe containing variables related to time, by default None

None
col_var pd.DataFrame

Dataframe containing variables related to columns, by default None

None

interpolate_even(data, freq, method='linear')

Interpolates the given dataframe according to the frequency

Parameters:

Name Type Description Default
data pd.DataFrame

Dataframe containing the data

required
freq str

Interpolation frequency

required
method str

Interpolation method, by default "linear"

'linear'

Returns:

Type Description
pd.DataFrame

Interpolated dataframe

interpolate_data()

Interpolates the raw data

Returns:

Type Description
pd.DataFrame

Interpolated data