Skip to content

Commit

Permalink
Merge branch 'main' into 12-task-2b-primary-locations-work
Browse files Browse the repository at this point in the history
  • Loading branch information
sgreenbury committed May 3, 2024
2 parents 86ff56d + fa5227b commit e6617cf
Show file tree
Hide file tree
Showing 13 changed files with 7,893 additions and 13,145 deletions.
53 changes: 0 additions & 53 deletions .github/workflows/cd.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.10, 3.12] # test oldest and latest supported versions
python-version: ['3.10', '3.11', '3.12'] # test oldest and latest supported versions
runs-on: [ubuntu-latest] # can be extended to other OSes, e.g. [ubuntu-latest, macos-latest]

steps:
Expand Down
35 changes: 9 additions & 26 deletions notebooks/1_prep_synthpop.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@
"metadata": {},
"outputs": [],
"source": [
"#import json\n",
"import pandas as pd\n",
"\n",
"#https://github.com/alan-turing-institute/uatk-spc/blob/55-output-formats-python/python/examples/spc_builder_example.ipynb\n",
"from uatk_spc.builder import Builder"
]
Expand Down Expand Up @@ -76,34 +73,13 @@
"spc_people_hh = (\n",
" Builder(path, region, backend=\"pandas\", input_type=\"parquet\")\n",
" .add_households()\n",
" .unnest([\"health\", \"employment\", \"details\"])\n",
" # remove nssec column\n",
" .unnest([\"health\", \"employment\", \"details\", \"demographics\"], rsuffix=\"_household\")\n",
" .build()\n",
")\n",
"\n",
"spc_people_hh.head(5)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# we need to unnest the demographic data. If we do this above\n",
"# we get an error as there will be two \"nssec8\" columns.\n",
"\n",
"# Unnest the JSON column\n",
"demographics = pd.json_normalize(spc_people_hh['demographics'])\n",
"\n",
"# Remove the columns we don't want\n",
"spc_people_hh = spc_people_hh.drop(['demographics', 'nssec8'], axis = 1)\n",
"# Add the unnested demographics column\n",
"spc_people_hh = pd.concat([spc_people_hh, demographics], axis = 1)\n",
"\n",
"spc_people_hh.head()"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down Expand Up @@ -194,6 +170,13 @@
"# save the output\n",
"spc_people_tu.write_parquet('../data/external/spc_output/' + region + '_people_tu.parquet')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand All @@ -212,7 +195,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.12"
"version": "3.11.8"
}
},
"nbformat": 4,
Expand Down
Loading

0 comments on commit e6617cf

Please sign in to comment.