diff --git a/mkdocs.yml b/mkdocs.yml deleted file mode 100644 index 0b58c4a..0000000 --- a/mkdocs.yml +++ /dev/null @@ -1,28 +0,0 @@ -site_name: My Super Cool Respository - - -# Repository -repo_name: My Super Cool Respository -repo_url: https://github.com/allfed/My Super-Cool-Respository -edit_uri: "" -# Copyright -copyright: Me - -docs_dir: "docs/sources" - -plugins: - - search - -theme: - name: 'readthedocs' - custom_dir: 'docs' - palette: - primary: 'white' - logo: 'assets/images/logo_full.svg' - favicon: 'assets/images/favicon.svg' - features: - - navigation.tabs - - navigation.tabs.sticky - - instant -nav: - diff --git a/mkgendocs.yml b/mkgendocs.yml deleted file mode 100644 index 99f75fe..0000000 --- a/mkgendocs.yml +++ /dev/null @@ -1,24 +0,0 @@ -site_name: My Super Cool Respository - - -# Repository -repo_name: My Super Cool Respository -repo: https://github.com/allfed/My-Super-Cool-Respository -# Copyright -copyright: ALLFED - -#This specifies the autogeneration portion -pages: - - page: "modules/src/preprocessing.md" - source: "src/preprocessing.py" - functions: - - rename_item - - read_faostat_bulk - - serialise_faostat_bulk - - _prep_trade_matrix - - _prep_production_vector - - _unify_indices - - format_prod_trad_data - - rename_countries - - remove_entries_from_data - diff --git a/src/model.py b/src/model.py index 6d66be9..796e527 100644 --- a/src/model.py +++ b/src/model.py @@ -224,8 +224,11 @@ def remove_countries_except(self): keep = [ country for country in self.trade_matrix.index if country in self.countries_to_keep ] - self.trade_matrix = self.trade_matrix.loc[keep, keep] - # TODO make this behaviour consistent with remove_countries + self.trade_matrix = self.trade_matrix.loc[keep, :] + # Now also remove the columns from the trade matrix which have no trade anymore + col_sums = self.trade_matrix.sum(axis=0) + b_filter = ~(col_sums.eq(0)) + self.trade_matrix = self.trade_matrix.loc[:, b_filter] self.production_data = self.production_data.loc[keep]