Patching Dec 9, 2021 6-7a CST- All GitLab services may be unavailable for 5-10 minutes

Commit 69fbcc39 authored by Matthew Krafczyk's avatar Matthew Krafczyk
Browse files

Adjust tests to use new sequence_df signature

parent 45267111
......@@ -17,7 +17,7 @@ def test_basic_group_col_1_1():
index=[0,1,2,3,4,5,6,7]
)
sequenced_df = pds.sequence_df(df, [-1,0], [('group', 'column', 'Group')])
sequenced_df = pds.sequence_df(df, [-1,0], group_specs=[('group', 'column', 'Group')])
target_df = pd.DataFrame(
[[1,2],
......@@ -45,7 +45,7 @@ def test_basic_group_col_1_2():
index=[0,1,2,3,4,5,6,7]
)
sequenced_df = pds.sequence_df(df, [-1,0], [('group', 'column', 'Group')])
sequenced_df = pds.sequence_df(df, [-1,0], group_specs=[('group', 'column', 'Group')])
target_df = pd.DataFrame(
[[1,2],
......@@ -74,7 +74,7 @@ def test_basic_group_col_1_3():
)
group_col = pd.Series([1,1,1,1,2,2,2,3])
sequenced_df = pds.sequence_df(df, [-1,0], [('group', 'column', group_col)])
sequenced_df = pds.sequence_df(df, [-1,0], group_specs=[('group', 'column', group_col)])
target_df = pd.DataFrame(
[[1,2],
......@@ -102,7 +102,7 @@ def test_basic_1():
index=[0,1,2,3,5,6,7,9]
)
sequenced_df = pds.sequence_df(df, [-1,0], [('sequence', 'index')])
sequenced_df = pds.sequence_df(df, [-1,0], group_specs=[('sequence', 'index')])
target_df = pd.DataFrame(
[[1,2],
......@@ -139,7 +139,7 @@ def test_basic_group_index_1():
names=['Group', 'count'])
)
sequenced_df = pds.sequence_df(df, [-1,0], [('group', 'level', 'Group')])
sequenced_df = pds.sequence_df(df, [-1,0], group_specs=[('group', 'level', 'Group')])
target_df = pd.DataFrame(
[[1,2],
......@@ -182,7 +182,7 @@ def test_basic_sequence_index_1():
names=['Group', 'count'])
)
sequenced_df = pds.sequence_df(df, [-1,0], [('sequence', 'level', 'count')])
sequenced_df = pds.sequence_df(df, [-1,0], group_specs=[('sequence', 'level', 'count')])
target_df = pd.DataFrame(
[[1,2],
......@@ -216,7 +216,7 @@ def test_basic_group_col_2_1():
index=[0,1,2,3,4,5,6,7]
)
sequenced_df = pds.sequence_df(df, [-1,0], [('group', 'column', 'Group')])
sequenced_df = pds.sequence_df(df, [-1,0], group_specs=[('group', 'column', 'Group')])
target_df = pd.DataFrame(
[[1,2],
......@@ -244,7 +244,7 @@ def test_basic_group_col_2_2():
index=[0,1,2,3,4,5,6,7]
)
sequenced_df = pds.sequence_df(df, [-1,0], [('group', 'column', 'Group')])
sequenced_df = pds.sequence_df(df, [-1,0], group_specs=[('group', 'column', 'Group')])
target_df = pd.DataFrame(
[[1,2],
......@@ -272,7 +272,7 @@ def test_basic_sequence_col_1_1():
index=[0,1,2,3,4,5,6,7]
)
sequenced_df = pds.sequence_df(df, [-1,0], [('sequence', 'column', 'Seq')])
sequenced_df = pds.sequence_df(df, [-1,0], group_specs=[('sequence', 'column', 'Seq')])
target_df = pd.DataFrame(
[[1,2],
......@@ -303,7 +303,7 @@ def test_basic_sequence_col_1_2():
def str_diff(s, ref_val):
return ord(s)-ord(ref_val)
sequenced_df = pds.sequence_df(df, [-1,0], [('sequence', 'column', 'Seq', str_diff)])
sequenced_df = pds.sequence_df(df, [-1,0], group_specs=[('sequence', 'column', 'Seq', str_diff)])
target_df = pd.DataFrame(
[[1,2],
......@@ -336,7 +336,7 @@ def test_basic_sequence_col_1_3():
def str_diff(s, ref_val):
return ord(s)-ord(ref_val)
sequenced_df = pds.sequence_df(df, [-1,0], [('sequence', 'column', sequence_col, str_diff)])
sequenced_df = pds.sequence_df(df, [-1,0], group_specs=[('sequence', 'column', sequence_col, str_diff)])
target_df = pd.DataFrame(
[[1,2],
......@@ -371,7 +371,7 @@ def test_large_1_1():
)
df = df.set_index(['Group', 'Date'])
sequenced_df = pds.sequence_df(df, [-1,0], [('group', 'level', 'Group')])
sequenced_df = pds.sequence_df(df, [-1,0], group_specs=[('group', 'level', 'Group')])
target_df = pd.DataFrame(
[['A', '2020-01-02', 0.2, -0.1],
......@@ -414,7 +414,7 @@ def test_large_1_2():
)
df = df.set_index(['Group', 'Date'])
sequenced_df = pds.sequence_df(df, [-2, 0, 1], [('group', 'level', 'Group')])
sequenced_df = pds.sequence_df(df, [-2, 0, 1], group_specs=[('group', 'level', 'Group')])
target_df = pd.DataFrame(
[['A', '2020-01-03', 0.2, 0.345, 0.55],
......@@ -451,7 +451,7 @@ def test_large_1_3():
)
df = df.set_index(['Group', 'Date'])
sequenced_df = pds.sequence_df(df, [0,-1], [('group', 'level', 'Group')])
sequenced_df = pds.sequence_df(df, [0,-1], group_specs=[('group', 'level', 'Group')])
target_df = pd.DataFrame(
[['A', '2020-01-02', -0.1, 0.2],
......@@ -494,7 +494,7 @@ def test_large_1_4():
)
df = df.set_index(['Group', 'Date'])
sequenced_df = pds.sequence_df(df, [-2, -1, 0], [('group', 'level', 'Group')])
sequenced_df = pds.sequence_df(df, [-2, -1, 0], group_specs=[('group', 'level', 'Group')])
target_df = pd.DataFrame(
[['A', '2020-01-03', 0.2, -0.1, 0.345],
......@@ -538,7 +538,7 @@ def test_large_1_5():
def days_diff(d, ref_val):
return (d-ref_val).days
sequenced_df = pds.sequence_df(df, [-1, 0], [('group', 'level', 'Group'), ('sequence', 'level', 'Date', days_diff)])
sequenced_df = pds.sequence_df(df, [-1, 0], group_specs=[('group', 'level', 'Group'), ('sequence', 'level', 'Date', days_diff)])
target_df = pd.DataFrame(
[['A', '2020-01-02', 0.2, -0.1],
......@@ -583,7 +583,7 @@ def test_large_1_6():
def days_diff(d, ref_val):
return (d-ref_val).days
sequenced_df = pds.sequence_df(df, [-1, 0], [('sequence', 'level', 'Date', days_diff)])
sequenced_df = pds.sequence_df(df, [-1, 0], group_specs=[('sequence', 'level', 'Date', days_diff)])
target_df = pd.DataFrame(
[['A', '2020-01-02', 0.2, -0.1],
......@@ -627,7 +627,7 @@ def test_nogrouping_1():
df['Date'] = pd.to_datetime(df['Date'])
df = df.set_index('Date')
sequenced_df = pds.sequence_df(df, [-1, 0], [])
sequenced_df = pds.sequence_df(df, [-1, 0])
target_df = pd.DataFrame(
[['2020-01-02', 0.2, -0.1],
......@@ -675,7 +675,7 @@ def test_nogrouping_2():
df['Date'] = pd.to_datetime(df['Date'])
df = df.set_index('Date')
sequenced_df = pds.sequence_df(df, [-1, 0], [])
sequenced_df = pds.sequence_df(df, [-1, 0], group_specs=[])
target_df = pd.DataFrame(
[['2020-01-01 01:00:00', 0.2, -0.1],
......@@ -722,7 +722,7 @@ def test_nogrouping_3():
)
df = df.set_index('Group')
sequenced_df = pds.sequence_df(df, [-1, 0], [])
sequenced_df = pds.sequence_df(df, [-1, 0])
target_df = pd.DataFrame(
[['A', 0.2, -0.1],
......
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