Skip to content

Commit d913290

Browse files
author
Sarra Nebli
committed
Fixing CI errors 11
1 parent a15e315 commit d913290

File tree

1 file changed

+0
-27
lines changed

1 file changed

+0
-27
lines changed

janitor/functions/adorn.py

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -197,33 +197,6 @@ def adorn_percentages(
197197
:param percent_format: Whether to format as percentages
198198
:return: DataFrame with percentages and optional formatting and raw counts
199199
200-
>>> data = {
201-
... "Category": ["A", "A", "B", "B", "C", "C", "A", "B", "C", "A"],
202-
... "Subcategory": ["X", "Y", "X", "Y", "X", "Y", "X", "Y", "X", "X"],
203-
... "Value": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
204-
... }
205-
>>> df = pd.DataFrame(data)
206-
207-
Example of axis=row
208-
>>> result = adorn_percentages(
209-
... df, "Category", "Subcategory", axis="row", fmt=True, include_ns=True
210-
... )
211-
>>> print(result)
212-
Subcategory Category X Y
213-
0 A 3 (75.0%) 1 (25.0%)
214-
1 B 1 (33.3%) 2 (66.7%)
215-
2 C 2 (66.7%) 1 (33.3%)
216-
Total NaN 6 (60.0%) 4 (40.0%)
217-
218-
>>> result = adorn_percentages(
219-
... df, "Category", "Subcategory", axis="all", fmt=True, include_ns=True
220-
... )
221-
>>> print(result)
222-
Subcategory Category X Y
223-
0 A 3 (42.9%) 1 (25.0%)
224-
1 B 1 (14.3%) 2 (50.0%)
225-
2 C 2 (28.6%) 1 (25.0%)
226-
Total NaN 6 (100.0%) 4 (100.0%)
227200
"""
228201
# Generate the crosstab using tabyl with the two specified columns
229202
pivot = pd.pivot_table(

0 commit comments

Comments
 (0)