Skip to content

Commit

Permalink
apply bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
victorlin committed Dec 10, 2021
1 parent 4e3e155 commit aba5515
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions augur/filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -957,8 +957,11 @@ def expand_date_col(metadata: pd.DataFrame, group_by_set: set) -> Tuple[pd.DataF
skipped_strains = []
# replace date with year/month/day as nullable ints
date_cols = ['year', 'month', 'day']
df_dates = (metadata_new['date'].str.split('-', n=2, expand=True)
.set_axis(date_cols, axis=1))
df_dates = metadata['date'].str.split('-', n=2, expand=True)
df_dates = df_dates.set_axis(date_cols[:len(df_dates.columns)], axis=1)
missing_date_cols = set(date_cols) - set(df_dates.columns)
for col in missing_date_cols:
df_dates[col] = pd.NA
for col in date_cols:
df_dates[col] = pd.to_numeric(df_dates[col], errors='coerce').astype(pd.Int64Dtype())
metadata_new = pd.concat([metadata_new.drop('date', axis=1), df_dates], axis=1)
Expand Down

0 comments on commit aba5515

Please sign in to comment.