We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9e9c295 commit d687383Copy full SHA for d687383
pandas/tests/generic/test_generic.py
@@ -603,19 +603,14 @@ def test_copy_and_deepcopy(self):
603
(-1, "bfill", 1, [np.nan, 0, -.5, -.5, -.6, np.nan, np.nan, np.nan])
604
])
605
def test_pct_change(self, periods, fill_method, limit, exp):
606
- obj = self._construct(0)
607
- is_frame = type(obj) is DataFrame
608
- ser = pd.Series([np.nan, np.nan, 1, 2, 4, 10, np.nan, np.nan])
609
- obj = pd.concat((obj, ser))
610
-
+ vals = [np.nan, np.nan, 1, 2, 4, 10, np.nan, np.nan]
+ obj = self._typ(vals)
611
func = getattr(obj, 'pct_change')
612
res = func(periods=periods, fill_method=fill_method, limit=limit)
613
614
- # Convert output into Series, regardless of input type
615
- if is_frame:
616
- res = res[0]
617
- res.name = None
618
- tm.assert_series_equal(res, pd.Series(exp))
+ if type(obj) is DataFrame:
+ tm.assert_frame_equal(res, DataFrame(exp))
+ else:
+ tm.assert_series_equal(res, Series(exp))
619
620
621
class TestNDFrame(object):
0 commit comments