Initial commit

This commit is contained in:
2025-11-05 12:58:07 -05:00
parent 94fc6df020
commit 5c5582088a
7 changed files with 999 additions and 0 deletions

48
pandas_helper.py Normal file
View File

@@ -0,0 +1,48 @@
import pandas as pd
import xlsxwriter
# Just a few functions to help with Pandas
def set_data_frame_transposed(passed_data):
df_data = pd.DataFrame(data=passed_data)
df_data = df_data.T
(col, row) = df_data.shape
return (df_data, col, row)
def set_data_frame(passed_data):
df_data = pd.DataFrame(data=passed_data)
(col, row) = df_data.shape
return (df_data, col, row)
def make_bar_chart(workbook, title, series_length, series_height, start_row, start_col):
end_row = (series_height + start_row - 1)
chart = workbook.add_chart({'type': 'column'})
chart.set_title({'name': f'{title}'})
for series in range(series_length):
chart.add_series({
'name': ['Tables', start_row-1, start_col+series],
'categories': ['Tables', start_row, start_col-1, end_row, start_col-1],
'values': ['Tables', start_row, start_col+series, end_row, start_col+series],
})
chart.set_size({'x_scale': 1.5, 'y_scale': 1.5})
return chart
def make_pie_chart(workbook, title, series_length, series_height, start_row, start_col):
end_row = (series_height + start_row - 1)
chart = workbook.add_chart({'type': 'pie'})
chart.set_title({'name': f'{title}'})
for series in range(series_length):
chart.add_series({
'name': ['Tables', start_row-1, start_col+series],
'categories': ['Tables', start_row, start_col-1, end_row, start_col-1],
'values': ['Tables', start_row, start_col+series, end_row, start_col+series],
'data_labels': {'category': True},
})
chart.set_size({'x_scale': 1.5, 'y_scale': 1.5})
return chart