Refactor normality test logic in portef_v3_4_3.ipynb

- Changed execution_count from 3 to null for a cleaner notebook state.
- Simplified the normality test logic by using a conditional expression to determine the p-value calculation, improving code readability.
This commit is contained in:
2025-10-14 10:46:56 +02:00
parent d8b535418c
commit ba158c366b
3 changed files with 6 additions and 9034 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -81,7 +81,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": null,
"id": "f1d15e71",
"metadata": {},
"outputs": [
@@ -154,17 +154,13 @@
"\n",
" Outputs: the number of yes/no in the results\n",
" \"\"\"\n",
"\n",
" pvalues = []\n",
" for cols in data.keys():\n",
" # normality test\n",
" if kolmogorov_smirnov:\n",
" # put in pv the p-value of the Kolmogorov-Smirnov test\n",
" pv = kstest(data[cols].dropna(), \"norm\").pvalue\n",
" else:\n",
" # put in pv the p-value of the default scipy.stats normality test\n",
" pv = normaltest(data[cols].dropna()).pvalue\n",
"\n",
" pv = (\n",
" kstest(data[cols].dropna(), \"norm\").pvalue\n",
" if kolmogorov_smirnov\n",
" else normaltest(data[cols].dropna()).pvalue\n",
" )\n",
" pvalues.append(pv)\n",
" if pv < level:\n",
" res = \"not normal\"\n",