Commit f90f30cd authored by Chris Jewell's avatar Chris Jewell
Browse files

Merge branch 'fix-summary-index-for-new-pandas-version' into 'master'

Hotfix for new pandas version

See merge request !10
parents d8f66c00 bb04c7e1
......@@ -192,7 +192,7 @@ def run_pipeline(global_config, results_directory, cli_options):
{"Pr(pred<obs)_7": exceed7, "Pr(pred<obs)_14": exceed14},
index=exceed7.coords["location"],
)
df.to_csv(output_file)
df.to_csv(output_file, index_label="location")
# Plot in-sample
# @rf.transform(
......
......@@ -68,7 +68,7 @@ def infec_incidence(input_file, output_file):
num_events = np.sum(events, axis=-1)
return mean_and_ci(num_events, name=name)
idx = prediction.coords["location"]
idx = pd.Index(prediction.coords["location"], name="location")
abs_incidence = pd.DataFrame(
pred_events(prediction[..., offset : (offset + 1), 2], name="cases"),
......@@ -81,7 +81,7 @@ def infec_incidence(input_file, output_file):
)
abs_incidence = pd.concat([abs_incidence, tmp], axis="columns")
abs_incidence.to_csv(output_file)
abs_incidence.to_csv(output_file, index_label="location")
def prevalence(input_files, output_file):
......@@ -105,7 +105,7 @@ def prevalence(input_files, output_file):
prev = np.sum(state[..., 1:3], axis=-1) / np.array(data["N"])
return mean_and_ci(prev, name=name)
idx = prediction.coords["location"]
idx = pd.Index(prediction.coords["location"], name="location")
prev = pd.DataFrame(
calc_prev(predicted_state[..., timepoints[0], :], name="prev"),
index=idx,
......@@ -117,4 +117,4 @@ def prevalence(input_files, output_file):
)
prev = pd.concat([prev, tmp], axis="columns")
prev.to_csv(output_file)
prev.to_csv(output_file, index_label="location")
......@@ -606,7 +606,7 @@ def summary_dha(input_files, output_folder, num_weeks, ci_list, config, url=""):
exceed14 = case_exceedance((input_files[0], input_files[2]), 14)
case_exceed = pd.DataFrame(
{"Pr(pred<obs)_7": exceed7, "Pr(pred<obs)_14": exceed14},
index=exceed7.coords["location"],
index=pd.Index(exceed7.coords["location"], name="location"),
)
case_exceed = (
case_exceed.reset_index()
......
[tool.poetry]
name = "covid-pipeline"
version = "0.2.2"
version = "0.2.3"
description = "COVID19 daily production"
authors = ["Chris Jewell <c.jewell@lancaster.ac.uk>"]
license = "MIT"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment