-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.py
More file actions
28 lines (24 loc) · 832 Bytes
/
Copy pathutils.py
File metadata and controls
28 lines (24 loc) · 832 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
def print_demographic_distribution(df):
"""
Prints the distribution of gender and race in the given dataframe.
:param df: The dataframe to analyze.
"""
gender_counts = {
"male": df["male"].sum(),
"female": df["female"].sum(),
"unknown": df["unknown"].sum()
}
race_counts = {
"white": df["white"].sum(),
"black": df["black"].sum(),
"asian": df["asian"].sum(),
"hispanic": df["hispanic"].sum(),
"other": df["other"].sum(),
"non-identified": df["non-identified"].sum()
}
print("Topics Distribution:")
for gender, count in gender_counts.items():
print(f"{gender.capitalize()}: {count}")
print("\nRace Distribution:")
for race, count in race_counts.items():
print(f"{race.capitalize()}: {count}")