diff --git a/scripts/data_prep/prep_dl.py b/scripts/data_prep/prep_dl.py index f5bb6e1..e4771a0 100644 --- a/scripts/data_prep/prep_dl.py +++ b/scripts/data_prep/prep_dl.py @@ -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( @@ -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__":