Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,4 @@ Contributors
- [@joranbeasley](https://github.com/joranbeasley) | [contributions](https://github.com/pyjanitor-devs/pyjanitor/issues?q=is%3Aclosed+mentions%joranbeasley)
-[@kianmeng](https://github.com/kianmeng) | [contributions](https://github.com/pyjanitor-devs/pyjanitor/pull/1290#issue-1906020324)
- [@lbeltrame](https://github.com/lbeltrame) | [contributions](https://github.com/pyjanitor-devs/pyjanitor/pull/1401)
- [@derekpowell](https://github.com/derekpowell) | [contributions](https://github.com/pyjanitor-devs/pyjanitor/issues?q=is%3Aclosed+mentions%3Aderekpowell)
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## [Unreleased]
- [ENH] Added `row_count` parameter for janitor.conditional_join - Issue #1269 @samukweku
- [ENG] Reverse deprecation of `pivot_wider()` -- Issue #1464
## [v0.31.0] - 2025-03-07

- [ENH] Added support for pd.Series.select - Issue #1394 @samukweku
Expand Down
13 changes: 1 addition & 12 deletions janitor/functions/pivot.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
_select_index,
get_index_labels,
)
from janitor.utils import check, refactored_function
from janitor.utils import check


@pf.register_dataframe_method
Expand Down Expand Up @@ -1863,12 +1863,6 @@ def _names_transform(


@pf.register_dataframe_method
@refactored_function(
message=(
"This function will be deprecated in a 1.x release. "
"Please use `pd.DataFrame.pivot` instead."
)
)
def pivot_wider(
df: pd.DataFrame,
index: list | str = None,
Expand All @@ -1883,11 +1877,6 @@ def pivot_wider(
) -> pd.DataFrame:
"""Reshapes data from *long* to *wide* form.

!!!note

This function will be deprecated in a 1.x release.
Please use `pd.DataFrame.pivot` instead.

The number of columns are increased, while decreasing
the number of rows. It is the inverse of the
[`pivot_longer`][janitor.functions.pivot.pivot_longer]
Expand Down
12 changes: 8 additions & 4 deletions tests/functions/test_pivot_wider.py
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ def test_names_expand(df_expand):
expected = df_expand.pivot_wider(
"year", "id", "percentage", names_expand=True, flatten_levels=False
)
assert_frame_equal(actual, expected)
assert_frame_equal(actual, expected, check_dtype=False)


def test_names_expand_flatten_levels(df_expand):
Expand All @@ -536,7 +536,7 @@ def test_names_expand_flatten_levels(df_expand):
expected = df_expand.pivot_wider(
"year", "id", "percentage", names_expand=True, flatten_levels=True
)
assert_frame_equal(actual, expected)
assert_frame_equal(actual, expected, check_dtype=False)


def test_index_expand(df_expand):
Expand Down Expand Up @@ -564,7 +564,9 @@ def test_index_expand_flatten_levels(df_expand):
assert_frame_equal(actual, expected)


@pytest.mark.xfail(reason="pivot_wider function slated for deprecation.")
@pytest.mark.xfail(
reason="pivot_wider function WAS slated for deprecation. -- additional fixes are needed."
)
def test_expand_multiple_levels(df_expand):
"""Test output for names_expand for multiple names_from."""
expected = df_expand.pivot_wider(
Expand All @@ -580,7 +582,9 @@ def test_expand_multiple_levels(df_expand):
assert_frame_equal(actual, expected)


@pytest.mark.xfail(reason="pivot_wider function slated for deprecation.")
@pytest.mark.xfail(
reason="pivot_wider function WAS slated for deprecation. -- additional fixes are needed."
)
def test_expand_multiple_levels_flatten_levels(df_expand):
"""Test output for names_expand for multiple names_from."""
expected = df_expand.pivot_wider(
Expand Down
Loading