mirror of
https://gitlab.com/PronounsPage/PronounsPage.git
synced 2025-09-23 20:54:48 -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',
|
||||
}
|
||||
|
||||
for group, group_stats in stats.items():
|
||||
for graph, graph_label in graphs.items():
|
||||
generateBar(group_stats[graph], group, graph, graph_label)
|
||||
|
||||
for comparison_key, comparison_groups in comparisons.items():
|
||||
ensureEmptyDir(outputDir / comparison_key)
|
||||
for graph, graph_label in graphs.items():
|
||||
data = pd.DataFrame({
|
||||
groupLabel: stats[group][graph]
|
||||
for group, groupLabel
|
||||
in comparison_groups.items()
|
||||
})
|
||||
generateBar(data, comparison_key, graph, graph_label)
|
||||
|
||||
by_year = {}
|
||||
for prev_year in [*diffs, year]:
|
||||
file_path = outputDir.parent / f'spis-{prev_year}' / 'general' / 'stats.json'
|
||||
if not file_path.exists():
|
||||
continue
|
||||
with open(file_path, 'r') as f:
|
||||
by_year[prev_year] = json.load(f)
|
||||
|
||||
ensureEmptyDir(outputDir / 'by_year')
|
||||
for graph, graph_label in graphs.items():
|
||||
data = pd.DataFrame({
|
||||
column_year: year_data[graph]
|
||||
for column_year, year_data
|
||||
in by_year.items()
|
||||
if graph in year_data
|
||||
})
|
||||
generateBar(data, 'by_year', graph, graph_label)
|
||||
# for group, group_stats in stats.items():
|
||||
# for graph, graph_label in graphs.items():
|
||||
# generateBar(group_stats[graph], group, graph, graph_label)
|
||||
#
|
||||
# for comparison_key, comparison_groups in comparisons.items():
|
||||
# ensureEmptyDir(outputDir / comparison_key)
|
||||
# for graph, graph_label in graphs.items():
|
||||
# data = pd.DataFrame({
|
||||
# groupLabel: stats[group][graph]
|
||||
# for group, groupLabel
|
||||
# in comparison_groups.items()
|
||||
# })
|
||||
# generateBar(data, comparison_key, graph, graph_label)
|
||||
#
|
||||
# by_year = {}
|
||||
# for prev_year in [*diffs, year]:
|
||||
# file_path = outputDir.parent / f'spis-{prev_year}' / 'general' / 'stats.json'
|
||||
# if not file_path.exists():
|
||||
# continue
|
||||
# with open(file_path, 'r') as f:
|
||||
# by_year[prev_year] = json.load(f)
|
||||
#
|
||||
# ensureEmptyDir(outputDir / 'by_year')
|
||||
# for graph, graph_label in graphs.items():
|
||||
# data = pd.DataFrame({
|
||||
# column_year: year_data[graph]
|
||||
# for column_year, year_data
|
||||
# in by_year.items()
|
||||
# if graph in year_data
|
||||
# })
|
||||
# generateBar(data, 'by_year', graph, graph_label)
|
||||
|
||||
write_ins_dir = outputDir / 'write_ins'
|
||||
write_ins_dir.mkdir(parents=True, exist_ok=True)
|
||||
for column in df.columns:
|
||||
if not column.endswith('__writein'):
|
||||
if not column.endswith('__writein') and column != '29_':
|
||||
continue
|
||||
|
||||
print(f'Extracting write-ins for question {column}')
|
||||
|
||||
writeins = df[column].dropna().value_counts().reset_index()
|
||||
writeins.columns = ['write-in', 'count']
|
||||
writeins = writeins[['count', 'write-in']]
|
||||
|
Loading…
x
Reference in New Issue
Block a user