mirror of
https://github.com/ArthurDanjou/ArtStudies.git
synced 2026-01-23 01:59:32 +01:00
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:
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user