Skip to content

Commit 120efb7

Browse files
committedFeb 3, 2023
Fix Bug Of Back Data Not Being Used By Link Filter.
1 parent 2a79fab commit 120efb7

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed
 

‎statistical_methods_library/imputation/ratio_of_means.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -219,11 +219,6 @@ def impute(
219219
["target", "forward", "backward", "construction"],
220220
)
221221

222-
if link_filter:
223-
filtered_refs = input_df.filter(link_filter).select(
224-
col(reference_col).alias("ref"), col(period_col).alias("period")
225-
)
226-
227222
# Cache the prepared back data df since we'll need a few differently
228223
# filtered versions
229224
prepared_back_data_df = None
@@ -232,6 +227,12 @@ def impute(
232227
prepared_back_data_df = validation.validate_dataframe(
233228
back_data_df, back_expected_columns, type_mapping, ["ref", "period"]
234229
)
230+
input_df = input_df.unionByName(back_data_df, allowMissingColumns=True)
231+
232+
if link_filter:
233+
filtered_refs = input_df.filter(link_filter).select(
234+
col(reference_col).alias("ref"), col(period_col).alias("period")
235+
)
235236

236237
# Store the value for the period prior to the start of imputation.
237238
# Stored as a value to avoid a join in output creation.

0 commit comments

Comments
 (0)
Please sign in to comment.