From 0b069e336b5251a101afa2b3bea13e1c770c69db Mon Sep 17 00:00:00 2001 From: Kenneth Enevoldsen Date: Tue, 10 Oct 2023 21:28:52 +0200 Subject: [PATCH] fix: updated pandas to allow for v2+ --- pyproject.toml | 1 + src/dacy/datasets/names.py | 1 + 2 files changed, 2 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 9b04b42e..5601a0fd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -220,6 +220,7 @@ commands = pytest -n auto {posargs:test} [testenv:type] +allowlist_externals = pyright description: run type checks extras = tests, dev basepython = py39 # Setting these explicitly avoid recreating env if your shell is set to a different version diff --git a/src/dacy/datasets/names.py b/src/dacy/datasets/names.py index 05ab7e10..8c0f716a 100644 --- a/src/dacy/datasets/names.py +++ b/src/dacy/datasets/names.py @@ -51,6 +51,7 @@ def load_names( names = names.groupby(["name", "gender", "first_name"]).agg({"count": "sum"}) # Change: groupby state_office and divide by sum names = names.groupby(level=0).apply(lambda x: x / float(x.sum().iloc[0])) + names = names.reset_index(level=0, drop=True) names = names.reset_index() names = names.loc[ (names["gender"] == gender) & (names["count"] >= min_prop_gender)