Skip to content
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

Fix/oecd data 2020 #723

Merged
merged 1 commit into from
Jun 20, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions data_updates/Python/oecd_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import datetime
import os
import pandas as pd
import sys
from data_updates.utils import push_folder_to_github


Expand Down Expand Up @@ -73,13 +74,18 @@

recip_data = recip_data.append(pd.DataFrame(data = total_data),ignore_index=True)

max_year = recip_data["Year"].max()

recip_data = recip_data.pivot_table(index=['Donor Name', 'Purpose Name','Recipient Name'], columns='Year', values='USD Disbursement Deflated').reset_index()

cols_to_check = [2016,2017,2018,2019,2020]
cols_to_check = list(range(max_year-4,max_year+1))

recip_data[cols_to_check] = recip_data[cols_to_check].fillna(0)

recip_data["Removal"] = (recip_data[2016]==0) & (recip_data[2017]==0) & (recip_data[2018]==0) & (recip_data[2019]==0)&(recip_data[2020]==0)
recip_data["Removal"] = [True]*len(recip_data.index)

for col in cols_to_check:
recip_data.loc[recip_data[col]!=0,"Removal"] = False

recip_data = recip_data[recip_data["Removal"]==False]

Expand Down