dts.append(dt) return ids, dts def convert2date(x, fmt="%Y-%m-%d %H:%M:%S"): from datetime import datetime as dt return dt.strptime(x.split(".")[0], fmt).date() import datetime from scipy.interpolate import interp1d as spline if __name__ == "__main__": d = data("./consensusPredictionData") predictions = d.importPredictions() d = data("./analysisData/") quantiles = d.importQuantiles() toaQids = d.timingOfApprovalQids() toaPreds = predictions.loc[toaQids] toaQuants = quantiles.loc[toaQids] toaQuants["value"] = toaQuants["value"].astype("datetime64[ns]") gd = data("./consensusPredictionData/") indivForecasts = gd.importIndividualForecasts() resolutions = indivForecasts.reset_index()
if legend: leg = ax.legend(loc="upper center", fontsize=10, ncol=3, bbox_to_anchor=(1.1, 1.35), frameon=False, handletextpad=0.075, labelspacing=0.01, columnspacing=0.15) else: ax.get_legend().remove() if __name__ == "__main__": gd = data("./consensusPredictionData/") individualScores = gd.importIndividualScores().reset_index() consensusScores = gd.importConsensusScores().reset_index() consensusScores["standin_id"] = consensusScores.expert + 900 # rank scores def rankforecasters(x): x["rank"] = x.logscore.rank() / len(x) return x individualAndConsScores = individualScores.append(consensusScores) individualAndConsRanks = individualAndConsScores.groupby( ["qid"]).apply(rankforecasters) individualRanks = individualAndConsRanks.loc[ individualAndConsRanks.standin_id < 900]