Skip to content

Commit 71d3519

Browse files
committed
Calculate p-values only if there are enough samples
1 parent a2f38bd commit 71d3519

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

jupyter/GitHistoryGeneral.ipynb

+18-7
Original file line numberDiff line numberDiff line change
@@ -1338,15 +1338,26 @@
13381338
"display(pairwise_changed_git_files_with_dependencies.corr(method='pearson'))\n",
13391339
"\n",
13401340
"display(\"Pairwise changed git files compared to dependency weights - Spearman Correlation\")\n",
1341-
"display(pairwise_changed_git_files_with_dependencies.corr(method='spearman'))\n",
1342-
"\n",
1343-
"from scipy.stats import pearsonr, spearmanr\n",
1341+
"display(pairwise_changed_git_files_with_dependencies.corr(method='spearman'))"
1342+
]
1343+
},
1344+
{
1345+
"cell_type": "code",
1346+
"execution_count": null,
1347+
"id": "5a4ae651",
1348+
"metadata": {},
1349+
"outputs": [],
1350+
"source": [
1351+
"if pairwise_changed_git_files_with_dependencies.shape[0] < 5:\n",
1352+
" print(\"Less than 5 samples are not enough to calculate p-values\")\n",
1353+
"else:\n",
1354+
" from scipy.stats import pearsonr, spearmanr\n",
13441355
"\n",
1345-
"display(\"Pearson Correlation with p-value for commitCount and dependencyWeight\")\n",
1346-
"display(pearsonr(pairwise_changed_git_files_with_dependencies['commitCount'], pairwise_changed_git_files_with_dependencies['dependencyWeight']))\n",
1356+
" display(\"Pearson Correlation with p-value for commitCount and dependencyWeight\")\n",
1357+
" display(pearsonr(pairwise_changed_git_files_with_dependencies['commitCount'], pairwise_changed_git_files_with_dependencies['dependencyWeight']))\n",
13471358
"\n",
1348-
"display(\"Spearman Correlation with p-value for commitCount and dependencyWeight\")\n",
1349-
"display(spearmanr(pairwise_changed_git_files_with_dependencies['commitCount'], pairwise_changed_git_files_with_dependencies['dependencyWeight']))"
1359+
" display(\"Spearman Correlation with p-value for commitCount and dependencyWeight\")\n",
1360+
" display(spearmanr(pairwise_changed_git_files_with_dependencies['commitCount'], pairwise_changed_git_files_with_dependencies['dependencyWeight']))"
13501361
]
13511362
},
13521363
{

0 commit comments

Comments
 (0)