Skip to content

Commit d0b0155

Browse files
committed
ENH: gb.is_monotonic_increasing pandas-dev#17015 fix test format, whatsnew format
1 parent eb0244e commit d0b0155

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

doc/source/whatsnew/v0.21.1.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Other Enhancements
2222
^^^^^^^^^^^^^^^^^^
2323

2424
- :meth:`Timestamp.timestamp` is now available in Python 2.7. (:issue:`17329`)
25-
- :func: groupby.is_monotonic_increasing and .is_monotonic_decreasing extend Series.is_monotonic_increasing to groups, returning whether each group is monotonically increasing or decreasing, respectively. (:issue:`17015`)
25+
- :meth:`groupby.is_monotonic_increasing()` and :meth:`.is_monotonic_decreasing()` extend :meth:`Series.is_monotonic_increasing()` to groups. (:issue:`17015`)
2626
-
2727

2828
.. _whatsnew_0211.deprecations:

pandas/tests/groupby/test_groupby.py

+5-9
Original file line numberDiff line numberDiff line change
@@ -2611,10 +2611,8 @@ def test_is_monotonic_increasing(self, in_vals, out_vals):
26112611
'C': in_vals}
26122612
df = pd.DataFrame(source_dict)
26132613
result = df.groupby(['B']).C.is_monotonic_increasing()
2614-
expected = pd.Series(index=['a', 'b', 'c', 'd'],
2615-
data=out_vals,
2616-
name='C')
2617-
expected.index.name = 'B'
2614+
index = pd.Index(list('abcd'), name='B')
2615+
expected = pd.Series(index=index, data=out_vals, name='C')
26182616
tm.assert_series_equal(result, expected)
26192617

26202618
# Also check result equal to manually taking x.is_monotonic_increasing.
@@ -2642,11 +2640,9 @@ def test_is_monotonic_decreasing(self, in_vals, out_vals):
26422640
'C': in_vals}
26432641

26442642
df = pd.DataFrame(source_dict)
2645-
result = df.groupby('B').C.is_monotonic_decreasing()
2646-
expected = pd.Series(index=['a', 'b', 'c', 'd'],
2647-
data=out_vals,
2648-
name='C')
2649-
expected.index.name = 'B'
2643+
result = df.groupby(['B']).C.is_monotonic_decreasing()
2644+
index = pd.Index(list('abcd'), name='B')
2645+
expected = pd.Series(index=index, data=out_vals, name='C')
26502646
tm.assert_series_equal(result, expected)
26512647

26522648
def test_apply_numeric_coercion_when_datetime(self):

0 commit comments

Comments
 (0)