ABalytics 3.0.2__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: abalytics
3
- Version: 3.0.2
3
+ Version: 3.0.4
4
4
  Summary: Advanced A/B Testing Statistical Analytics
5
5
  Author: Janis Berneker
6
6
  License: LICENSE
@@ -125,9 +125,23 @@ pretty_text = format_results_as_table(
125
125
  )
126
126
  print(pretty_text)
127
127
  ```
128
- Executing this code will output a neatly formatted table displaying the outcomes of the statistical significance tests. The table includes the sample size, indicators for Levene's test and Gaussian distribution, and the test results.
128
+ Executing this code will output a neatly formatted table displaying the outcomes of the statistical significance tests. The table includes the sample size and the test results. Optionally, you can set `show_details` to `True` to include additional details such as the a priori and posthoc tests used. By default, only the significant results are displayed. This can be changed by setting `show_only_significant_results` to `False`.
129
129
 
130
- A further example of how to use ABalytics can be found in `examples/example.py`.
130
+ Example output:
131
+ ```
132
+ Test name Channel n Result p-value
133
+ -------------------- ---------- ----- ------------------------------------------------ ---------
134
+ A/B Test 1 Mobile 5009 new_cta_1 (0.16) > new_cta_2 (0.15) 0.007
135
+ A/B Test 1 Tablet 2887 new_cta_1 (0.22) > new_cta_2 (0.20) 0.000
136
+ A/B Test 1 Tablet 2887 new_cta_1 (0.22) > old_implementation (0.20) 0.005
137
+ A/B Test 1 Desktop 20014 new_cta_1 (0.18) > new_cta_2 (0.17) 0.000
138
+ A/B Test 1 Desktop 20014 new_cta_1 (0.18) > old_implementation (0.17) 0.000
139
+ A/B Test 2 Mobile 268 new_cta_1 (0.10) > new_cta_2 (0.06) 0.006
140
+ A/B Test 2 Mobile 268 new_cta_1 (0.10) > old_implementation (0.06) 0.014
141
+ A/B Test 2 Desktop 5609 new_cta_1 (0.13) > new_cta_2 (0.12) 0.025
142
+ ```
143
+
144
+ Further examples of how to use ABalytics can be found in `examples/example.py`.
131
145
 
132
146
  ## Contributing
133
147
 
@@ -108,9 +108,23 @@ pretty_text = format_results_as_table(
108
108
  )
109
109
  print(pretty_text)
110
110
  ```
111
- Executing this code will output a neatly formatted table displaying the outcomes of the statistical significance tests. The table includes the sample size, indicators for Levene's test and Gaussian distribution, and the test results.
111
+ Executing this code will output a neatly formatted table displaying the outcomes of the statistical significance tests. The table includes the sample size and the test results. Optionally, you can set `show_details` to `True` to include additional details such as the a priori and posthoc tests used. By default, only the significant results are displayed. This can be changed by setting `show_only_significant_results` to `False`.
112
112
 
113
- A further example of how to use ABalytics can be found in `examples/example.py`.
113
+ Example output:
114
+ ```
115
+ Test name Channel n Result p-value
116
+ -------------------- ---------- ----- ------------------------------------------------ ---------
117
+ A/B Test 1 Mobile 5009 new_cta_1 (0.16) > new_cta_2 (0.15) 0.007
118
+ A/B Test 1 Tablet 2887 new_cta_1 (0.22) > new_cta_2 (0.20) 0.000
119
+ A/B Test 1 Tablet 2887 new_cta_1 (0.22) > old_implementation (0.20) 0.005
120
+ A/B Test 1 Desktop 20014 new_cta_1 (0.18) > new_cta_2 (0.17) 0.000
121
+ A/B Test 1 Desktop 20014 new_cta_1 (0.18) > old_implementation (0.17) 0.000
122
+ A/B Test 2 Mobile 268 new_cta_1 (0.10) > new_cta_2 (0.06) 0.006
123
+ A/B Test 2 Mobile 268 new_cta_1 (0.10) > old_implementation (0.06) 0.014
124
+ A/B Test 2 Desktop 5609 new_cta_1 (0.13) > new_cta_2 (0.12) 0.025
125
+ ```
126
+
127
+ Further examples of how to use ABalytics can be found in `examples/example.py`.
114
128
 
115
129
  ## Contributing
116
130
 
@@ -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(output_results, headers="keys", floatfmt=".3f", tablefmt=output_format)
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()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: abalytics
3
- Version: 3.0.2
3
+ Version: 3.0.4
4
4
  Summary: Advanced A/B Testing Statistical Analytics
5
5
  Author: Janis Berneker
6
6
  License: LICENSE
@@ -125,9 +125,23 @@ pretty_text = format_results_as_table(
125
125
  )
126
126
  print(pretty_text)
127
127
  ```
128
- Executing this code will output a neatly formatted table displaying the outcomes of the statistical significance tests. The table includes the sample size, indicators for Levene's test and Gaussian distribution, and the test results.
128
+ Executing this code will output a neatly formatted table displaying the outcomes of the statistical significance tests. The table includes the sample size and the test results. Optionally, you can set `show_details` to `True` to include additional details such as the a priori and posthoc tests used. By default, only the significant results are displayed. This can be changed by setting `show_only_significant_results` to `False`.
129
129
 
130
- A further example of how to use ABalytics can be found in `examples/example.py`.
130
+ Example output:
131
+ ```
132
+ Test name Channel n Result p-value
133
+ -------------------- ---------- ----- ------------------------------------------------ ---------
134
+ A/B Test 1 Mobile 5009 new_cta_1 (0.16) > new_cta_2 (0.15) 0.007
135
+ A/B Test 1 Tablet 2887 new_cta_1 (0.22) > new_cta_2 (0.20) 0.000
136
+ A/B Test 1 Tablet 2887 new_cta_1 (0.22) > old_implementation (0.20) 0.005
137
+ A/B Test 1 Desktop 20014 new_cta_1 (0.18) > new_cta_2 (0.17) 0.000
138
+ A/B Test 1 Desktop 20014 new_cta_1 (0.18) > old_implementation (0.17) 0.000
139
+ A/B Test 2 Mobile 268 new_cta_1 (0.10) > new_cta_2 (0.06) 0.006
140
+ A/B Test 2 Mobile 268 new_cta_1 (0.10) > old_implementation (0.06) 0.014
141
+ A/B Test 2 Desktop 5609 new_cta_1 (0.13) > new_cta_2 (0.12) 0.025
142
+ ```
143
+
144
+ Further examples of how to use ABalytics can be found in `examples/example.py`.
131
145
 
132
146
  ## Contributing
133
147
 
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name='abalytics',
5
- version='3.0.2',
5
+ version='3.0.4',
6
6
  author='Janis Berneker',
7
7
  packages=find_packages(),
8
8
  license='LICENSE',
File without changes
File without changes