mirror of
https://gitlab.com/PronounsPage/PronounsPage.git
synced 2025-09-24 05:05:20 -04:00
(pl)(census) raport 2024 – WIP
This commit is contained in:
parent
0f17885c06
commit
2faf01072f
@ -317,44 +317,46 @@ if __name__ == '__main__':
|
|||||||
'transitionSurgical': 'Tranzycja medyczna – zmiany chirurgiczne',
|
'transitionSurgical': 'Tranzycja medyczna – zmiany chirurgiczne',
|
||||||
}
|
}
|
||||||
|
|
||||||
for group, group_stats in stats.items():
|
# for group, group_stats in stats.items():
|
||||||
for graph, graph_label in graphs.items():
|
# for graph, graph_label in graphs.items():
|
||||||
generateBar(group_stats[graph], group, graph, graph_label)
|
# generateBar(group_stats[graph], group, graph, graph_label)
|
||||||
|
#
|
||||||
for comparison_key, comparison_groups in comparisons.items():
|
# for comparison_key, comparison_groups in comparisons.items():
|
||||||
ensureEmptyDir(outputDir / comparison_key)
|
# ensureEmptyDir(outputDir / comparison_key)
|
||||||
for graph, graph_label in graphs.items():
|
# for graph, graph_label in graphs.items():
|
||||||
data = pd.DataFrame({
|
# data = pd.DataFrame({
|
||||||
groupLabel: stats[group][graph]
|
# groupLabel: stats[group][graph]
|
||||||
for group, groupLabel
|
# for group, groupLabel
|
||||||
in comparison_groups.items()
|
# in comparison_groups.items()
|
||||||
})
|
# })
|
||||||
generateBar(data, comparison_key, graph, graph_label)
|
# generateBar(data, comparison_key, graph, graph_label)
|
||||||
|
#
|
||||||
by_year = {}
|
# by_year = {}
|
||||||
for prev_year in [*diffs, year]:
|
# for prev_year in [*diffs, year]:
|
||||||
file_path = outputDir.parent / f'spis-{prev_year}' / 'general' / 'stats.json'
|
# file_path = outputDir.parent / f'spis-{prev_year}' / 'general' / 'stats.json'
|
||||||
if not file_path.exists():
|
# if not file_path.exists():
|
||||||
continue
|
# continue
|
||||||
with open(file_path, 'r') as f:
|
# with open(file_path, 'r') as f:
|
||||||
by_year[prev_year] = json.load(f)
|
# by_year[prev_year] = json.load(f)
|
||||||
|
#
|
||||||
ensureEmptyDir(outputDir / 'by_year')
|
# ensureEmptyDir(outputDir / 'by_year')
|
||||||
for graph, graph_label in graphs.items():
|
# for graph, graph_label in graphs.items():
|
||||||
data = pd.DataFrame({
|
# data = pd.DataFrame({
|
||||||
column_year: year_data[graph]
|
# column_year: year_data[graph]
|
||||||
for column_year, year_data
|
# for column_year, year_data
|
||||||
in by_year.items()
|
# in by_year.items()
|
||||||
if graph in year_data
|
# if graph in year_data
|
||||||
})
|
# })
|
||||||
generateBar(data, 'by_year', graph, graph_label)
|
# generateBar(data, 'by_year', graph, graph_label)
|
||||||
|
|
||||||
write_ins_dir = outputDir / 'write_ins'
|
write_ins_dir = outputDir / 'write_ins'
|
||||||
write_ins_dir.mkdir(parents=True, exist_ok=True)
|
write_ins_dir.mkdir(parents=True, exist_ok=True)
|
||||||
for column in df.columns:
|
for column in df.columns:
|
||||||
if not column.endswith('__writein'):
|
if not column.endswith('__writein') and column != '29_':
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
print(f'Extracting write-ins for question {column}')
|
||||||
|
|
||||||
writeins = df[column].dropna().value_counts().reset_index()
|
writeins = df[column].dropna().value_counts().reset_index()
|
||||||
writeins.columns = ['write-in', 'count']
|
writeins.columns = ['write-in', 'count']
|
||||||
writeins = writeins[['count', 'write-in']]
|
writeins = writeins[['count', 'write-in']]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user