ABalytics 3.0.3__tar.gz → 3.0.6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {abalytics-3.0.3 → abalytics-3.0.6}/PKG-INFO +1 -1
- {abalytics-3.0.3 → abalytics-3.0.6}/abalytics/significance_tests.py +7 -7
- {abalytics-3.0.3 → abalytics-3.0.6}/abalytics/utils.py +32 -3
- {abalytics-3.0.3 → abalytics-3.0.6}/abalytics.egg-info/PKG-INFO +1 -1
- {abalytics-3.0.3 → abalytics-3.0.6}/setup.py +1 -1
- {abalytics-3.0.3 → abalytics-3.0.6}/LICENSE +0 -0
- {abalytics-3.0.3 → abalytics-3.0.6}/README.md +0 -0
- {abalytics-3.0.3 → abalytics-3.0.6}/abalytics/__init__.py +0 -0
- {abalytics-3.0.3 → abalytics-3.0.6}/abalytics/analysis.py +0 -0
- {abalytics-3.0.3 → abalytics-3.0.6}/abalytics.egg-info/SOURCES.txt +0 -0
- {abalytics-3.0.3 → abalytics-3.0.6}/abalytics.egg-info/dependency_links.txt +0 -0
- {abalytics-3.0.3 → abalytics-3.0.6}/abalytics.egg-info/requires.txt +0 -0
- {abalytics-3.0.3 → abalytics-3.0.6}/abalytics.egg-info/top_level.txt +0 -0
- {abalytics-3.0.3 → abalytics-3.0.6}/setup.cfg +0 -0
|
@@ -242,7 +242,7 @@ def get_games_howell_posthoc_results(
|
|
|
242
242
|
key=lambda x: x["mean"],
|
|
243
243
|
reverse=True,
|
|
244
244
|
)
|
|
245
|
-
result_pretty_text = f"{groups_info[0]['name']} ({groups_info[0]['mean']:.
|
|
245
|
+
result_pretty_text = f"{groups_info[0]['name']} ({groups_info[0]['mean']:.3f}) > {groups_info[1]['name']} ({groups_info[1]['mean']:.3f})"
|
|
246
246
|
posthoc_results.add_result(
|
|
247
247
|
"Games-Howell", result_pretty_text, row["pval"], groups_info
|
|
248
248
|
)
|
|
@@ -338,7 +338,7 @@ def get_tukeyhsd_posthoc_results(
|
|
|
338
338
|
key=lambda x: x["mean"],
|
|
339
339
|
reverse=True,
|
|
340
340
|
)
|
|
341
|
-
result_pretty_text = f"{groups_info[0]['name']} ({groups_info[0]['mean']:.
|
|
341
|
+
result_pretty_text = f"{groups_info[0]['name']} ({groups_info[0]['mean']:.3f}) > {groups_info[1]['name']} ({groups_info[1]['mean']:.3f})"
|
|
342
342
|
posthoc_results.add_result(
|
|
343
343
|
"Tukey HSD", result_pretty_text, row["p-adj"], groups_info
|
|
344
344
|
)
|
|
@@ -398,7 +398,7 @@ def get_dunn_posthoc_results(
|
|
|
398
398
|
reverse=True,
|
|
399
399
|
)
|
|
400
400
|
|
|
401
|
-
result_pretty_text = f"{groups_info[0]['name']} ({groups_info[0]['mean']:.
|
|
401
|
+
result_pretty_text = f"{groups_info[0]['name']} ({groups_info[0]['mean']:.3f}) > {groups_info[1]['name']} ({groups_info[1]['mean']:.3f})"
|
|
402
402
|
posthoc_results.add_result(
|
|
403
403
|
"Dunn", result_pretty_text, p_value, groups_info
|
|
404
404
|
)
|
|
@@ -445,7 +445,7 @@ def get_mcnemar_results(
|
|
|
445
445
|
# Sort groups by mean for consistent presentation
|
|
446
446
|
groups_info.sort(key=lambda x: x["mean"], reverse=True)
|
|
447
447
|
# Format the result text
|
|
448
|
-
result_pretty_text = f"{groups_info[0]['name']} ({groups_info[0]['mean']:.
|
|
448
|
+
result_pretty_text = f"{groups_info[0]['name']} ({groups_info[0]['mean']:.3f}) > {groups_info[1]['name']} ({groups_info[1]['mean']:.3f})"
|
|
449
449
|
# Add the result to posthoc results
|
|
450
450
|
posthoc_results.add_result(
|
|
451
451
|
"McNemar", result_pretty_text, p_value, groups_info
|
|
@@ -528,7 +528,7 @@ def get_repeated_measures_anova_posthoc_results(
|
|
|
528
528
|
]
|
|
529
529
|
# Sort groups by mean for consistent presentation
|
|
530
530
|
groups_info.sort(key=lambda x: x["mean"], reverse=True)
|
|
531
|
-
result_pretty_text = f"{groups_info[0]['name']} ({groups_info[0]['mean']:.
|
|
531
|
+
result_pretty_text = f"{groups_info[0]['name']} ({groups_info[0]['mean']:.3f}) > {groups_info[1]['name']} ({groups_info[1]['mean']:.3f})"
|
|
532
532
|
posthoc_results.add_result(
|
|
533
533
|
"Repeated Measures ANOVA",
|
|
534
534
|
result_pretty_text,
|
|
@@ -576,7 +576,7 @@ def get_wilcoxon_results(
|
|
|
576
576
|
]
|
|
577
577
|
groups_info.sort(key=lambda x: x["mean"], reverse=True)
|
|
578
578
|
|
|
579
|
-
result_pretty_text = f"{groups_info[0]['name']} ({groups_info[0]['mean']:.
|
|
579
|
+
result_pretty_text = f"{groups_info[0]['name']} ({groups_info[0]['mean']:.3f}) > {groups_info[1]['name']} ({groups_info[1]['mean']:.3f})"
|
|
580
580
|
posthoc_results.add_result("Wilcoxon", result_pretty_text, p_value, groups_info)
|
|
581
581
|
|
|
582
582
|
return p_value, posthoc_results
|
|
@@ -633,7 +633,7 @@ def get_nemenyi_results(
|
|
|
633
633
|
]
|
|
634
634
|
groups_info.sort(key=lambda x: x["mean"], reverse=True)
|
|
635
635
|
|
|
636
|
-
result_pretty_text = f"{groups_info[0]['name']} ({groups_info[0]['mean']:.
|
|
636
|
+
result_pretty_text = f"{groups_info[0]['name']} ({groups_info[0]['mean']:.3f}) > {groups_info[1]['name']} ({groups_info[1]['mean']:.3f})"
|
|
637
637
|
posthoc_results.add_result(
|
|
638
638
|
"Nemenyi", result_pretty_text, posthoc_p_value, groups_info
|
|
639
639
|
)
|
|
@@ -21,7 +21,6 @@ def get_table_header(max_identifier_length: int) -> str:
|
|
|
21
21
|
|
|
22
22
|
def format_results_as_table(
|
|
23
23
|
abalytics_results: List[PosthocResults],
|
|
24
|
-
header: bool = True,
|
|
25
24
|
identifiers_list: Optional[List[dict]] = None,
|
|
26
25
|
show_only_significant_results: bool = False,
|
|
27
26
|
show_details: bool = False,
|
|
@@ -65,7 +64,7 @@ def format_results_as_table(
|
|
|
65
64
|
row = identifiers_list[idx].copy()
|
|
66
65
|
row["n"] = sample_size
|
|
67
66
|
row["Result"] = result.result_pretty_text
|
|
68
|
-
row["p-value"] = result.p_value
|
|
67
|
+
row["p-value"] = result.p_value
|
|
69
68
|
if show_details:
|
|
70
69
|
row["Analysis method"] = result.analysis_method
|
|
71
70
|
if info:
|
|
@@ -84,5 +83,35 @@ def format_results_as_table(
|
|
|
84
83
|
row["A priori test"] = a_priori_test
|
|
85
84
|
output_results.append(row)
|
|
86
85
|
|
|
87
|
-
table = tabulate(
|
|
86
|
+
table = tabulate(
|
|
87
|
+
output_results, headers="keys", floatfmt=".3f", tablefmt=output_format
|
|
88
|
+
)
|
|
88
89
|
return table
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def convert_long_to_wide(
|
|
93
|
+
df: pd.DataFrame, index_col: str, columns_col: str, flatten_columns: bool = True
|
|
94
|
+
) -> pd.DataFrame:
|
|
95
|
+
"""
|
|
96
|
+
Converts a DataFrame from long format to wide format, turning all columns into 'column_group' format.
|
|
97
|
+
Optionally flattens multi-level columns into single-level.
|
|
98
|
+
|
|
99
|
+
Parameters:
|
|
100
|
+
df (pd.DataFrame): The DataFrame in long format.
|
|
101
|
+
index_col (str): The name of the column to use as the identifier (index) in the wide format.
|
|
102
|
+
columns_col (str): The name of the column that contains the group names in the long format.
|
|
103
|
+
flatten_columns (bool, optional): Whether to flatten multi-level columns into single-level. Defaults to True.
|
|
104
|
+
|
|
105
|
+
Returns:
|
|
106
|
+
pd.DataFrame: The DataFrame converted to wide format, with optional column flattening.
|
|
107
|
+
"""
|
|
108
|
+
# Create a pivot table with multi-level columns
|
|
109
|
+
wide_df = df.pivot_table(index=index_col, columns=columns_col, aggfunc="first")
|
|
110
|
+
|
|
111
|
+
if flatten_columns:
|
|
112
|
+
# Flatten the multi-level columns and create combined column names
|
|
113
|
+
wide_df.columns = [
|
|
114
|
+
"{}_{}".format(col[0], col[1]) for col in wide_df.columns.values
|
|
115
|
+
]
|
|
116
|
+
|
|
117
|
+
return wide_df.reset_index()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|