ABalytics 3.0.3__tar.gz → 3.0.4__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.4}/PKG-INFO +1 -1
- {abalytics-3.0.3 → abalytics-3.0.4}/abalytics/utils.py +31 -2
- {abalytics-3.0.3 → abalytics-3.0.4}/abalytics.egg-info/PKG-INFO +1 -1
- {abalytics-3.0.3 → abalytics-3.0.4}/setup.py +1 -1
- {abalytics-3.0.3 → abalytics-3.0.4}/LICENSE +0 -0
- {abalytics-3.0.3 → abalytics-3.0.4}/README.md +0 -0
- {abalytics-3.0.3 → abalytics-3.0.4}/abalytics/__init__.py +0 -0
- {abalytics-3.0.3 → abalytics-3.0.4}/abalytics/analysis.py +0 -0
- {abalytics-3.0.3 → abalytics-3.0.4}/abalytics/significance_tests.py +0 -0
- {abalytics-3.0.3 → abalytics-3.0.4}/abalytics.egg-info/SOURCES.txt +0 -0
- {abalytics-3.0.3 → abalytics-3.0.4}/abalytics.egg-info/dependency_links.txt +0 -0
- {abalytics-3.0.3 → abalytics-3.0.4}/abalytics.egg-info/requires.txt +0 -0
- {abalytics-3.0.3 → abalytics-3.0.4}/abalytics.egg-info/top_level.txt +0 -0
- {abalytics-3.0.3 → abalytics-3.0.4}/setup.cfg +0 -0
|
@@ -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,
|
|
@@ -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
|
|
File without changes
|