Skip to content

Commit

Permalink
Remove rounding
Browse files Browse the repository at this point in the history
  • Loading branch information
sgreenbury committed Sep 29, 2023
1 parent 5578a97 commit 635b65d
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions scripts/data_prep/prep_dl.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def get_flattened_df(url: str) -> pd.DataFrame:
break
else:
features += offset_features
# Max number of results per request
offset += 2000
df = pd.DataFrame.from_records(features)
return pd.concat(
Expand All @@ -37,13 +38,16 @@ def main():
print("Getting LSOA data...")
df_lsoas = get_flattened_df(LSOA_URL)
outpath = "Data/dl"
rounding = 9
df_oas.round(rounding).to_csv(
f"{outpath}/Output_Areas_Dec_2011_PWC_2022.csv", index=None
df_oas.to_csv(
f"{outpath}/Output_Areas_Dec_2011_PWC_2022.csv",
index=None,
line_terminator="\r\n",
)
df_lsoas.rename(columns={"lsoa11nm": "LSOA11NM", "lsoa11cd": "LSOA11CD"}).to_csv(
f"{outpath}/LSOA_Dec_2011_PWC_in_England_and_Wales_2022.csv",
index=None,
line_terminator="\r\n",
)
df_lsoas.round(rounding).rename(
columns={"lsoa11nm": "LSOA11NM", "lsoa11cd": "LSOA11CD"}
).to_csv(f"{outpath}/LSOA_Dec_2011_PWC_in_England_and_Wales_2022.csv", index=None)


if __name__ == "__main__":
Expand Down

0 comments on commit 635b65d

Please sign in to comment.