Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion docassemble/InterviewStats/data/questions/stats.yml
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,15 @@ subquestion: |
[${col}](${ url_action('show_grouped_data', group_by = col) })
% endfor

${ formatted_data.groupby(by=my_col).count().to_html(classes=('table','table-striped')) }
<%
grouped = formatted_data.groupby(by=my_col).count()
grouped = grouped.sort_values(grouped.columns[0], ascending=False)
total_groups = len(grouped)
%>
% if total_groups > 50:
Showing the top 50 of ${ total_groups } groups by count. Download the Excel file below for the full breakdown.
% endif
${ grouped.head(50).to_html(classes=('table','table-striped')) }

[:file-excel: Download](${ url_ask('generate_excel') })
% else:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ code: |
if what_to_do == 'generate':
number_of_data_points
# Edit your data here
ma_zips = ['01001', '01002', '02330', '02332', '02771', '027771',
'02125', '02122', '02124', '02123', '02115', '02116']
ma_zips = list(set([f'{random.randint(75001, 79999):05}' for _ in range(300)])) \
+ list(set([f'{random.randint(1001,2799):05}' for _ in range(300)]))
def my_generator():
for _ in range(number_of_data_points):
yield {'zip': random.choice(ma_zips), 'state': 'MA'}
Expand Down
Loading