Skip to content

Hotfix for new pandas version

Chris Jewell requested to merge fix-summary-index-for-new-pandas-version into master

In previous pandas versions,

df = read.csv("/path/to/file.csv")

foo = pd.Dataframe(df['bar'], index=df['baz'])

would result in foo's index being named baz. In pandas==1.1.3 (on which covid19uk depends), the column name is not used as the index name, resulting in an un-named index. Thus, the index now needs to be explicitly constructed

foo = pd.DataFrame(df['bar'], index=pd.Index(df['baz'], name='baz'))

to get a named index.

CHANGES:

  1. Explicit index naming in summarize.py, summary_dha.py.

Merge request reports

Loading