Skip to content

Commit

Permalink
copy processed scottish council data to media
Browse files Browse the repository at this point in the history
Enables it to be downloaded
  • Loading branch information
struan committed Mar 24, 2022
1 parent e84f13e commit fe197f7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion caps/management/commands/process_scottish_reporting_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from collections import defaultdict

from os.path import join
from shutil import copy

import pandas as pd
import numpy as np
Expand Down Expand Up @@ -457,5 +458,9 @@ def save_data(self):
for name, data in self.data.items():
df = pd.DataFrame(data)

outfile = join(settings.SCOTTISH_DIR, "{}_data.csv".format(name))
file_name = "{}_data.csv".format(name)
outfile = join(settings.SCOTTISH_DIR, file_name)
df.to_csv(open(outfile, "w"), index=False, header=True)

dst = join(settings.MEDIA_ROOT, "data", file_name)
copy(outfile, dst)

0 comments on commit fe197f7

Please sign in to comment.