-
Notifications
You must be signed in to change notification settings - Fork 2
Zero out fuel spending for non-fuel households #247
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| - bump: patch | ||
| changes: | ||
| fixed: | ||
| - Zero out fuel spending for households without fuel consumption |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -344,6 +344,12 @@ def impute_consumption(dataset: UKSingleYearDataset) -> UKSingleYearDataset: | |
| for column in output_df.columns: | ||
| dataset.household[column] = output_df[column].values | ||
|
|
||
| # Zero out fuel spending for households without fuel consumption | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Quick verification: |
||
| # This ensures only ICE vehicle owners contribute to fuel duty | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This direct assignment to a subset of |
||
| no_fuel = has_fuel_consumption == 0 | ||
| dataset.household["petrol_spending"][no_fuel] = 0 | ||
| dataset.household["diesel_spending"][no_fuel] = 0 | ||
|
|
||
| dataset.validate() | ||
|
|
||
| return dataset | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good addition - the documentation clearly explains what happens and why.