diff --git a/csv_to_html.py b/csv_to_html.py deleted file mode 100755 index 716f66d..0000000 --- a/csv_to_html.py +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env python3 - -import pandas as pd -import shutil - -html_dir = "docs/" -html_table = f"{html_dir}problems.html" -html_header = f"{html_dir}header.html" -html_scripts = f"{html_dir}javascript.html" -html_footer = f"{html_dir}footer.html" -html_index = f"{html_dir}index.html" - -# Generate plain table -data = pd.read_csv("problems.csv") -table = data.to_html(render_links=True, - index=False, - table_id="problems", - classes=["display compact", "display", "styled-table"], # Set display style - border=0, - na_rep="") # Leave NaN cells empty - -# Add footer to facilitate individual column search -idx = table.index('') -final_table = table[:idx] + "" + " ".join([""+ i +"" for i in data.columns])+" " + table[idx:] - -# Write table to file -with open(html_table, "w") as table_file: - table_file.write(final_table) - -# Merge table and scripts into HTML page -with open(html_index, "wb") as output_file: - for in_file in [html_header, html_table, html_scripts, html_footer]: - with open(in_file, "rb") as in_file: - shutil.copyfileobj(in_file, output_file) diff --git a/csv_to_yaml.py b/csv_to_yaml.py deleted file mode 100755 index fd19453..0000000 --- a/csv_to_yaml.py +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env python3 - -import pandas as pd -import yaml - -csv_file = "problems.csv" -yaml_file = "problems.yaml" - -# Read the csv file -data = pd.read_csv(csv_file) - -# Handle empty cells being read as 'NaN', by emptying them again -data = data.fillna("") - -# Write the yaml file -with open(yaml_file, "w") as out_file: - yaml.dump(data.to_dict(orient="records"), out_file, - sort_keys=False) # Prevent columns being reordered alphabetically