-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
60e4e0b
commit a2d2b77
Showing
20 changed files
with
2,452 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,183 @@ | ||
|
||
|
||
"source": [ | ||
"gw = pd.read_excel(\"WFA_girls.xlsx\")\n", | ||
"gw['age']=gw['Month']\n", | ||
"gw = gw.drop('Month',axis=1)\n", | ||
"print(gw)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 383, | ||
"id": "1474f562-9026-49d7-a324-a1db9b648edf", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
" age id weight L M S SD4neg SD3neg SD2neg \\\n", | ||
"goutham 78 2 20 -0.3804 21.6810 0.13554 12.96 14.855 16.751 \n", | ||
"john123 65 3 19 -0.2443 19.2132 0.13142 11.48 13.186 14.892 \n", | ||
"\n", | ||
" SD1neg SD0 SD1 SD2 SD3 SD4 WZ \n", | ||
"goutham 18.997 21.681 24.918 28.862 33.723 38.583 -0.604660 \n", | ||
"john123 16.882 19.213 21.959 25.210 29.083 32.956 -0.085023 \n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"merged_gw = pd.DataFrame()\n", | ||
"# print(merged_gw)\n", | ||
"merged_gw = pd.merge(weight_df_girl, gw, left_on='age', right_on='age', how='left')\n", | ||
"merged_gw.set_index(df_girl.index, inplace=True)\n", | ||
"# print(merged_gw)\n", | ||
"# Calculate L * M * S and create a new column in df_girl\n", | ||
"merged_gw['WZ'] = ((merged_gw['weight']/merged_gw['M'])**merged_gw['L'] -1)/(merged_gw['L'] * merged_gw['S'])\n", | ||
"# print(merged_df_girl)\n", | ||
"# print(merged_df_girl['WZ'])\n", | ||
"# Now you can use merged_df_girl to see the updated DataFrame\n", | ||
"weight_df_girl = merged_gw\n", | ||
"\n", | ||
"# Show the updated df_girl with the new column\n", | ||
"print(weight_df_girl)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 384, | ||
"id": "a5e7c58a-de94-4dbe-ac31-1973e0f4ca09", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
" L M S SD4neg SD3neg SD2neg SD1neg SD0 SD1 \\\n", | ||
"0 -0.7387 15.2641 0.08390 11.204 12.118 13.031 14.071 15.264 16.645 \n", | ||
"1 -0.7621 15.2616 0.08414 11.204 12.115 13.027 14.066 15.262 16.648 \n", | ||
"2 -0.7856 15.2604 0.08439 11.204 12.114 13.024 14.063 15.260 16.653 \n", | ||
"3 -0.8089 15.2605 0.08464 11.205 12.114 13.022 14.061 15.260 16.659 \n", | ||
"4 -0.8322 15.2619 0.08490 11.207 12.114 13.021 14.060 15.262 16.667 \n", | ||
".. ... ... ... ... ... ... ... ... ... \n", | ||
"163 -0.9048 22.0374 0.12911 14.148 15.811 17.473 19.504 22.037 25.281 \n", | ||
"164 -0.8892 22.0760 0.12920 14.151 15.823 17.495 19.535 22.076 25.324 \n", | ||
"165 -0.8735 22.1140 0.12930 14.153 15.834 17.515 19.564 22.114 25.366 \n", | ||
"166 -0.8578 22.1514 0.12939 14.155 15.845 17.535 19.594 22.151 25.408 \n", | ||
"167 -0.8419 22.1883 0.12948 14.156 15.855 17.554 19.622 22.188 25.449 \n", | ||
"\n", | ||
" SD2 SD3 SD4 age \n", | ||
"0 18.259 20.166 22.072 61 \n", | ||
"1 18.273 20.200 22.127 62 \n", | ||
"2 18.290 20.238 22.186 63 \n", | ||
"3 18.308 20.277 22.247 64 \n", | ||
"4 18.328 20.320 22.312 65 \n", | ||
".. ... ... ... ... \n", | ||
"163 29.572 35.503 41.434 224 \n", | ||
"164 29.609 35.507 41.406 225 \n", | ||
"165 29.646 35.512 41.378 226 \n", | ||
"166 29.681 35.515 41.348 227 \n", | ||
"167 29.716 35.516 41.317 228 \n", | ||
"\n", | ||
"[168 rows x 13 columns]\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"gg = pd.read_excel(\"BFA_girls.xlsx\")\n", | ||
"gg['age']=gg['Month']\n", | ||
"gg = gg.drop('Month',axis=1)\n", | ||
"print(gg)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 385, | ||
"id": "4b1155dd-0e94-4b2c-ae51-4778e3d4f26a", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
" age id BMI\n", | ||
"goutham 78 2 16.53\n", | ||
"john123 65 3 11.24\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"bmi_df_girl = pd.DataFrame()\n", | ||
"bmi_df_girl[['age','id','BMI']] = df_girl[['age','id','BMI']]\n", | ||
"print(bmi_df_girl)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 386, | ||
"id": "d1bd97d2-58fb-4301-b5e1-90331746918c", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
" age id BMI L M S SD4neg SD3neg SD2neg \\\n", | ||
"goutham 78 2 16.53 -1.1230 15.3825 0.08865 11.292 12.189 13.086 \n", | ||
"john123 65 3 11.24 -0.8322 15.2619 0.08490 11.207 12.114 13.021 \n", | ||
"\n", | ||
" SD1neg SD0 SD1 SD2 SD3 SD4 BZ \n", | ||
"goutham 14.136 15.382 16.888 18.745 21.097 23.449 0.779658 \n", | ||
"john123 14.060 15.262 16.667 18.328 20.320 22.312 -4.102910 \n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"merged_gg = pd.DataFrame()\n", | ||
"# print(merged_gg)\n", | ||
"merged_gg = pd.merge(bmi_df_girl, gg, left_on='age', right_on='age', how='left')\n", | ||
"merged_gg.set_index(df_girl.index, inplace=True)\n", | ||
"# print(merged_gg)\n", | ||
"# Calculate L * M * S and create a new column in df_girl\n", | ||
"merged_gg['BZ'] = ((merged_gg['BMI']/merged_gg['M'])**merged_gg['L'] -1)/(merged_gg['L'] * merged_gg['S'])\n", | ||
"# print(merged_gg)\n", | ||
"# print(merged_gg['BZ'])\n", | ||
"# Now you can use merged_df_girl to see the updated DataFrame\n", | ||
"bmi_df_girl = merged_gg\n", | ||
"\n", | ||
"# Show the updated df_girl with the new column\n", | ||
"print(bmi_df_girl)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "4bd7447d-99d9-4602-8918-bfaa2601f66a", | ||
"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.12.2" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import nbformat | ||
|
||
# Load the notebook | ||
with open("data_zscore.ipynb", "r", encoding="utf-8") as f: | ||
notebook = nbformat.read(f, as_version=4) | ||
|
||
# Extract code cells | ||
code_cells = [cell["source"] for cell in notebook.cells if cell.cell_type == "code"] | ||
|
||
# Save to a Python file | ||
with open("extracted_code.py", "w", encoding="utf-8") as f: | ||
f.write("\n\n".join(code_cells)) |
Oops, something went wrong.