timeseries_scripts/imputation.py
def resample_markers(group):
    '''Resample marker column from 15 to 60 min

    Parameters
    ----------
    group: pd.Series
        Series of 4 succeeding quarter-hourly values from the marker column
        that have to be combined into one.

    Returns
    ----------
    aggregated_marker : str or np.nan
        If there were any markers in group: the unique values from the marker
        column group joined together in one string, np.nan otherwise

    '''

    if group.notnull().values.any():
        # unpack string of markers into a list
        unpacked = [mark for line in group if type(line) is str
                    for mark in line.split(' | ')]  # [:-1]]
        # keep only unique values from the list
        aggregated_marker = ' | '.join(set(unpacked))  # + ' | '

    else:
        aggregated_marker = np.nan

    return aggregated_marker
Resample marker column from 15 to 60 min

    Parameters
    ----------
    group: pd.Series
        Series of 4 succeeding quarter-hourly values from the marker column
        that have to be combined into one.

    Returns
    ----------
    aggregated_marker : str or np.nan
        If there were any markers in group: the unique values from the marker
        column group joined together in one string, np.nan otherwise

    
Resample marker column from 15 to 60 min
Parameters

pd.Series
Series of 4 succeeding quarter-hourly values from the marker column
that have to be combined into one.

Returns

aggregated_marker : str or np.nan
If there were any markers in group: the unique values from the marker
column group joined together in one string, np.nan otherwise
Resample marker column from 15 to 60 min Parameters pd . Series Series of 4 succeeding quarter - hourly values from the marker column that have to be combined into one . Returns aggregated_marker : str or np . nan If there were any markers in group : the unique values from the marker column group joined together in one string np . nan otherwise
def resample_markers(group):
    if group.notnull().values.any():
        unpacked = [mark for line in group if type(line) is str
                    for mark in line.split(' | ')]  
        aggregated_marker = ' | '.join(set(unpacked))  
    else:
        aggregated_marker = np.nan
    return aggregated_marker
def resample_markers ( group ) : if group . notnull ( ) . values . any ( ) : unpacked = [ mark for line in group if type ( line ) is str for mark in line . split ( ' | ' ) ] aggregated_marker = ' | ' . join ( set ( unpacked ) ) else : aggregated_marker = np . nan return aggregated_marker
Resample marker column from 15 to 60 min
Parameters
Resample marker column from 15 to 60 min Parameters
'''Resample marker column from 15 to 60 min

    Parameters
    ----------
    group: pd.Series
        Series of 4 succeeding quarter-hourly values from the marker column
        that have to be combined into one.

    Returns
    ----------
    aggregated_marker : str or np.nan
        If there were any markers in group: the unique values from the marker
        column group joined together in one string, np.nan otherwise

    ''' # unpack string of markers into a list # [:-1]] # keep only unique values from the list # + ' | '
group