Skip to content

REF: dont use compute_reduction #34913

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 20, 2020
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
8 changes: 1 addition & 7 deletions pandas/core/apply.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,13 +220,7 @@ def apply_empty_result(self):

def apply_raw(self):
""" apply to the values as a numpy array """
result, reduction_success = libreduction.compute_reduction(
self.values, self.f, axis=self.axis
)

# We expect np.apply_along_axis to give a two-dimensional result, or raise.
if not reduction_success:
result = np.apply_along_axis(self.f, self.axis, self.values)
result = np.apply_along_axis(self.f, self.axis, self.values)

# TODO: mixed type case
if result.ndim == 2:
Expand Down
3 changes: 0 additions & 3 deletions pandas/tests/frame/test_apply.py
Original file line number Diff line number Diff line change
Expand Up @@ -745,9 +745,6 @@ def non_reducing_function(row):
df.apply(func, axis=1)
assert names == list(df.index)

@pytest.mark.xfail(
reason="The 'run once' enhancement for apply_raw not implemented yet."
)
def test_apply_raw_function_runs_once(self):
# https://github.com/pandas-dev/pandas/issues/34506

Expand Down