Skip to content

Commit

Permalink
changed according to comments
Browse files Browse the repository at this point in the history
  • Loading branch information
tp committed Jun 23, 2018
1 parent ad06799 commit 962fcb1
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 10 deletions.
2 changes: 1 addition & 1 deletion doc/source/whatsnew/v0.24.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ Numeric
^^^^^^^

- Bug in :class:`Series` ``__rmatmul__`` doesn't support matrix vector multiplication (:issue:`21530`)
-
- :meth:`~DataFrame.agg` now handles built-in methods like ``sum`` with axis=1 (:issue:`21224`)
-

Strings
Expand Down
15 changes: 15 additions & 0 deletions pandas/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,21 @@ def spmatrix(request):
return getattr(sparse, request.param + '_matrix')


@pytest.fixture(params=[0, 1],
ids=lambda x: "axis {}".format(x))
def axis(request):
"""
Fixture for returning the axis numbers of a dataframe.
"""
return request.param

@pytest.fixture(params=[0], ids=lambda x: "axis {}".format(x))
def axis_series(request):
"""
Fixture for returning the axis numbers of a series.
"""
return request.param

@pytest.fixture
def ip():
"""
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -1829,7 +1829,7 @@ def error():
error()
raise
except:
raise
raise error()

if not ax.contains(key):
error()
Expand Down
1 change: 0 additions & 1 deletion pandas/tests/frame/test_analytics.py
Original file line number Diff line number Diff line change
Expand Up @@ -2094,7 +2094,6 @@ def test_clip_against_list_like(self, inplace, lower, axis, res):
@pytest.mark.xfail(
not _np_version_under1p15,
reason="failing under numpy-dev gh-19976")
@pytest.mark.parametrize("axis", [0, 1, None])
def test_clip_against_frame(self, axis):
df = DataFrame(np.random.randn(1000, 2))
lb = DataFrame(np.random.randn(1000, 2))
Expand Down
7 changes: 0 additions & 7 deletions pandas/tests/generic/test_label_or_level_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ def assert_level_reference(frame, levels, axis):

# DataFrame
# ---------
@pytest.mark.parametrize('axis', [0, 1])
def test_is_level_or_label_reference_df_simple(df_levels, axis):

# Compute expected labels and levels
Expand All @@ -91,7 +90,6 @@ def test_is_level_or_label_reference_df_simple(df_levels, axis):
assert_label_reference(df_levels, expected_labels, axis=axis)


@pytest.mark.parametrize('axis', [0, 1])
def test_is_level_reference_df_ambig(df_ambig, axis):

# Transpose frame if axis == 1
Expand Down Expand Up @@ -165,7 +163,6 @@ def test_is_label_or_level_reference_panel_error(panel):

# DataFrame
# ---------
@pytest.mark.parametrize('axis', [0, 1])
def test_check_label_or_level_ambiguity_df(df_ambig, axis):

# Transpose frame if axis == 1
Expand Down Expand Up @@ -264,7 +261,6 @@ def assert_level_values(frame, levels, axis):

# DataFrame
# ---------
@pytest.mark.parametrize('axis', [0, 1])
def test_get_label_or_level_values_df_simple(df_levels, axis):

# Compute expected labels and levels
Expand All @@ -279,7 +275,6 @@ def test_get_label_or_level_values_df_simple(df_levels, axis):
assert_level_values(df_levels, expected_levels, axis=axis)


@pytest.mark.parametrize('axis', [0, 1])
def test_get_label_or_level_values_df_ambig(df_ambig, axis):

# Transpose frame if axis == 1
Expand All @@ -300,7 +295,6 @@ def test_get_label_or_level_values_df_ambig(df_ambig, axis):
assert_label_values(df_ambig, ['L3'], axis=axis)


@pytest.mark.parametrize('axis', [0, 1])
def test_get_label_or_level_values_df_duplabels(df_duplabels, axis):

# Transpose frame if axis == 1
Expand Down Expand Up @@ -383,7 +377,6 @@ def assert_levels_dropped(frame, levels, axis):

# DataFrame
# ---------
@pytest.mark.parametrize('axis', [0, 1])
def test_drop_labels_or_levels_df(df_levels, axis):

# Compute expected labels and levels
Expand Down

0 comments on commit 962fcb1

Please sign in to comment.