Skip to content

Instantly share code, notes, and snippets.

@citizenrich
Created July 9, 2022 05:21
Show Gist options
  • Select an option

  • Save citizenrich/2389b332f72cc8934cdb8301d168164e to your computer and use it in GitHub Desktop.

Select an option

Save citizenrich/2389b332f72cc8934cdb8301d168164e to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 5,
"id": "4d17eeb5-7b2d-4e10-a29f-ac8633418a95",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" time age gender Diagnosed_Early_Years \\\n",
"0 283996800922-347155200921 0-150 M 0.97 \n",
"1 283996800922-347155200921 0-150 F 0.97 \n",
"2 347155200922-410227200921 0-24 M 0.97 \n",
"3 347155200922-410227200921 0-24 F 0.97 \n",
"4 347155200922-410227200921 25-44 M 0.97 \n",
".. ... ... ... ... \n",
"495 1546300800922-1577836800921 35-44 F 0.97 \n",
"496 1546300800922-1577836800921 45-54 M 0.97 \n",
"497 1546300800922-1577836800921 45-54 F 0.97 \n",
"498 1546300800922-1577836800921 55-150 M 0.97 \n",
"499 1546300800922-1577836800921 55-150 F 0.97 \n",
"\n",
" Wait_Until_Next_Diagnosis_Check \n",
"0 0.03 \n",
"1 0.03 \n",
"2 0.03 \n",
"3 0.03 \n",
"4 0.03 \n",
".. ... \n",
"495 0.03 \n",
"496 0.03 \n",
"497 0.03 \n",
"498 0.03 \n",
"499 0.03 \n",
"\n",
"[500 rows x 5 columns]\n",
" time age gender Diagnosed_Later_Years \\\n",
"0 725846400922-757382400921 0-12 M 0.97 \n",
"1 725846400922-757382400921 0-12 F 0.97 \n",
"2 725846400922-757382400921 13-24 M 0.97 \n",
"3 725846400922-757382400921 13-24 F 0.97 \n",
"4 725846400922-757382400921 25-34 M 0.97 \n",
".. ... ... ... ... \n",
"319 1546300800922-1577836800921 35-44 F 0.97 \n",
"320 1546300800922-1577836800921 45-54 M 0.97 \n",
"321 1546300800922-1577836800921 45-54 F 0.97 \n",
"322 1546300800922-1577836800921 55-150 M 0.97 \n",
"323 1546300800922-1577836800921 55-150 F 0.97 \n",
"\n",
" Wait_Until_Next_Diagnosis_Check \n",
"0 0.03 \n",
"1 0.03 \n",
"2 0.03 \n",
"3 0.03 \n",
"4 0.03 \n",
".. ... \n",
"319 0.03 \n",
"320 0.03 \n",
"321 0.03 \n",
"322 0.03 \n",
"323 0.03 \n",
"\n",
"[324 rows x 5 columns]\n"
]
}
],
"source": [
"import pandas as pd\n",
"\n",
"# edit hiv_diagnosis_early\n",
"# Diagnosed_Early_Years + Wait_Until_Next_Diagnosis_Check must equal 1\n",
"df = pd.read_csv(\"src/main/resources/modules/lookup_tables/hiv_diagnosis_early.csv\")\n",
"df['Diagnosed_Early_Years'] = 0.97\n",
"df['Wait_Until_Next_Diagnosis_Check'] = 0.03\n",
"df.to_csv(\"src/main/resources/modules/lookup_tables/hiv_diagnosis_early.csv\", index=False)\n",
"print(df)\n",
"\n",
"# edit: hiv_diagnosis_later\n",
"# Diagnosed_Later_Years + Wait_Until_Next_Diagnosis_Check must equal 1\n",
"df2 = pd.read_csv(\"src/main/resources/modules/lookup_tables/hiv_diagnosis_later.csv\")\n",
"df2['Diagnosed_Later_Years'] = 0.97\n",
"df2['Wait_Until_Next_Diagnosis_Check'] = 0.03\n",
"df2.to_csv(\"src/main/resources/modules/lookup_tables/hiv_diagnosis_later.csv\", index=False)\n",
"print(df2)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "6dbbd724-c639-4301-b653-9c6d70bf18c6",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.13"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment