Commit 2a1970e5 authored by Matthew Krafczyk's avatar Matthew Krafczyk
Browse files

Fix small error in a named argument

parent 59058383
......@@ -58,19 +58,20 @@ def contiguous_group_indices(df, index_level=None, sequence_col=None, sequence_f
# Fetch sequence series
sequence_series = None
if sequence_col is None:
# Get the sequence series
sequence_series = df.index.to_series()
elif type(sequence_col) is pd.core.series.Series:
sequence_series = sequence_col
if sequence_col is not None:
if type(sequence_col) is pd.core.series.Series:
# Use the sequence column if it's a Series
sequence_series = sequence_col
sequence_series = df[sequence_col]
elif index_level is not None:
if index_level not in df.index.names:
raise ValueError(f"index_level {index_level} not in the data frame. available levels: {df.index.names}")
level_idx = df.index.names.index(index_level)
sequence_series = df.index.to_series().apply(lambda t: t[level_idx])
# Get the sequence col
sequence_series = df[sequence_col]
# Get the dataframe index
sequence_series = df.index.to_series()
# If the sequence function is None, set it as the simple difference formula
if sequence_function is None:
......@@ -141,7 +142,7 @@ def sequence_plain_df(df, num_before, num_after, inc_val=True):
return DF
def sequence_df(df, num_before, num_after, beg_val=None, end_val=None, inc_val=True, index_val=None, sequence_col=None, sequence_function=None):
def sequence_df(df, num_before, num_after, beg_val=None, end_val=None, inc_val=True, index_level=None, sequence_col=None, sequence_function=None):
Sequence feature data into multi-component rows.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment