def query_prop_data(dir_name=None, ents_dict=None, locations=None, depth=0, timespan=None, interval=None): """ Queries data for the module property for given location(s), depth, timespan and interval. """ df, ents_dict = data_utils.query_wd_prop( dir_name=dir_name, ents_dict=ents_dict, locations=locations, depth=depth, timespan=timespan, interval=interval, pid=pid, sub_pid=sub_pid, col_name=col_name, col_prefix=col_prefix, ignore_char=ignore_char, span=span, ) return df, ents_dict
def query_prop_data(dir_name=None, ents_dict=None, locations=None, depth=0, timespan=None, interval=None): """ Queries data for the module property for given location(s), depth, timespan and interval. """ df, ents_dict = data_utils.query_wd_prop( dir_name=dir_name, ents_dict=ents_dict, locations=locations, depth=depth, timespan=timespan, interval=interval, pid=pid, sub_pid=sub_pid, col_name=col_name, col_prefix=col_prefix, ignore_char=ignore_char, span=span, ) org_renames = [ ("mem_world_trade_organization", "mem_wto"), ("mem_european_union", "mem_eu"), ("mem_organisation_for_economic_cooperation_and_development", "mem_oecd"), ("mem_united_nations", "mem_un"), ("mem_world_health_organization", "mem_who"), ("mem_international_monetary_fund", "mem_imf"), ] for o_r in org_renames: if o_r[0] in df.columns: df.rename(columns={o_r[0]: o_r[1]}, inplace=True) df.fillna(value=False, inplace=True) return df, ents_dict
def query_prop_data(dir_name=None, ents_dict=None, locations=None, depth=0, timespan=None, interval=None): """ Queries data for the module property for given location(s), depth, timespan and interval. """ df, ents_dict = data_utils.query_wd_prop( dir_name=dir_name, ents_dict=ents_dict, locations=locations, depth=depth, timespan=timespan, interval=interval, pid=pid, sub_pid=sub_pid, col_name=col_name, col_prefix=col_prefix, ignore_char=ignore_char, span=span, ) fixes = [ ["Aruba", "Netherlands"], # Territory ["Abkhazia", "Georgia"], # Recognized by most states as a part of Georgia ["Denmark", "Denmark"], # Fix ["Ghana", "Ghana"], # Fix ["Guinea-Bissau", "Guinea-Bissau"], # Fix ["Guernsey", "United Kingdom"], # Territory ["Jersey", "United Kingdom"], # Territory ["Nauru", "Nauru"], # Fix [ "Republic of Artsakh", "Azerbaijan", ], # Recognized by most states as a part of Azerbaijan ["Sri Lanka", "Sri Lanka"], # Fix ["South Ossetia", "Georgia"], # Recognized by most states as a part of Georgia ["Transnistria", "Moldova"], # Recognized by most states as a part of Moldova [ "Turkish Republic of Northern Cyprus", "Cyprus", ], # Recognized by most states as a part of Cyprus ["Western Sahara", "Morocco"], ] # 80% is controlled by Morocco for f in fixes: if f[0] in list(df[lctn_utils.depth_to_col_name(depth)]): df.loc[df.loc[df[lctn_utils.depth_to_col_name(depth)] == f[0]].index, col_name] = f[1] df[col_name] = df[col_name].replace("Kingdom of the Netherlands", "Netherlands") df[col_name] = df[col_name].replace("Kingdom of Denmark", "Denmark") df[col_name] = df[col_name].replace("Danish Realm", "Denmark") return df, ents_dict