Skip to content

Commit

Permalink
Merge pull request #952 from lisphilar/issue951
Browse files Browse the repository at this point in the history
fix: #951
  • Loading branch information
lisphilar authored Oct 30, 2021
2 parents ae7da43 + 5a8ee15 commit 0e791c2
Showing 1 changed file with 0 additions and 8 deletions.
8 changes: 0 additions & 8 deletions covsirphy/cleaning/jhu_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,6 @@ def _cleaning(self):
df[col] = df.groupby([self.COUNTRY, self.PROVINCE])[col].ffill().fillna(0).astype(np.int64)
# Calculate Infected
df[self.CI] = (df[self.C] - df[self.F] - df[self.R]).astype(np.int64)
# As country level data in China, use the total values of provinces
p_chn_df = df.loc[(df[self.COUNTRY] == "China") & (df[self.PROVINCE] != self.UNKNOWN)]
p_chn_df = p_chn_df.groupby(self.DATE).sum().reset_index()
p_chn_df.insert(0, self.COUNTRY, "China")
p_chn_df.insert(0, self.PROVINCE, self.UNKNOWN)
p_chn_df[self.ISO3] = self.country_to_iso3(country="China", check_data=False)
without_c_chn_df = df.loc[(df[self.COUNTRY] != "China") | (df[self.PROVINCE] != self.UNKNOWN)]
df = pd.concat([without_c_chn_df, p_chn_df], ignore_index=True)
# Update data types to reduce memory
df[self.AREA_ABBR_COLS] = df[self.AREA_ABBR_COLS].astype("category")
return df.loc[:, self._raw_cols]
Expand Down

0 comments on commit 0e791c2

Please sign in to comment.