chore(script): Fix type error
This commit is contained in:
parent
bd25353fa1
commit
2b986b46a6
1 changed files with 3 additions and 0 deletions
|
@ -593,6 +593,7 @@ the overall output volume strongly increased during this period.
|
||||||
```{python}
|
```{python}
|
||||||
#| label: fig-publications-per-year
|
#| label: fig-publications-per-year
|
||||||
#| fig-cap: Publications per year
|
#| fig-cap: Publications per year
|
||||||
|
from typing import cast
|
||||||
|
|
||||||
df_study_years = (
|
df_study_years = (
|
||||||
df.groupby(["author", "year", "title"])
|
df.groupby(["author", "year", "title"])
|
||||||
|
@ -602,6 +603,8 @@ df_study_years = (
|
||||||
["year"].value_counts()
|
["year"].value_counts()
|
||||||
.sort_index()
|
.sort_index()
|
||||||
)
|
)
|
||||||
|
df_study_years = cast(pd.DataFrame, df_study_years) # fix potential type errors
|
||||||
|
|
||||||
# use order to ensure all years are displayed, even ones without values
|
# use order to ensure all years are displayed, even ones without values
|
||||||
years_range = list(range(df_study_years.index.min(), df_study_years.index.max()+1))
|
years_range = list(range(df_study_years.index.min(), df_study_years.index.max()+1))
|
||||||
ax = sns.barplot(df_study_years, order=years_range)
|
ax = sns.barplot(df_study_years, order=years_range)
|
||||||
|
|
Loading…
Reference in a new issue