diff --git a/pandas/core/generic.py b/pandas/core/generic.py index 1656d52c35eeb..610c5a0da2cff 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -701,7 +701,7 @@ def iterkv(self, *args, **kwargs): "iteritems alias used to get around 2to3. Deprecated" warnings.warn("iterkv is deprecated and will be removed in a future " "release, use ``iteritems`` instead.", - DeprecationWarning) + FutureWarning) return self.iteritems(*args, **kwargs) def __len__(self): @@ -2004,13 +2004,13 @@ def sample(self, n=None, frac=None, replace=False, weights=None, random_state=No Sample with or without replacement. Default = False. weights : str or ndarray-like, optional Default 'None' results in equal probability weighting. - If passed a Series, will align with target object on index. Index + If passed a Series, will align with target object on index. Index values in weights not found in sampled object will be ignored and - index values in sampled object not in weights will be assigned - weights of zero. + index values in sampled object not in weights will be assigned + weights of zero. If called on a DataFrame, will accept the name of a column when axis = 0. - Unless weights are a Series, weights must be same length as axis + Unless weights are a Series, weights must be same length as axis being sampled. If weights do not sum to 1, they will be normalized to sum to 1. Missing values in the weights column will be treated as zero. @@ -2040,8 +2040,8 @@ def sample(self, n=None, frac=None, replace=False, weights=None, random_state=No if weights is not None: # If a series, align with frame - if isinstance(weights, pd.Series): - weights = weights.reindex(self.axes[axis]) + if isinstance(weights, pd.Series): + weights = weights.reindex(self.axes[axis]) # Strings acceptable if a dataframe and axis = 0 if isinstance(weights, string_types): diff --git a/pandas/tests/test_frame.py b/pandas/tests/test_frame.py index 465f1da05ebde..d6e825d8fd000 100644 --- a/pandas/tests/test_frame.py +++ b/pandas/tests/test_frame.py @@ -14188,7 +14188,7 @@ def test_take(self): assert_frame_equal(result, expected) def test_iterkv_deprecation(self): - with tm.assert_produces_warning(DeprecationWarning): + with tm.assert_produces_warning(FutureWarning): self.mixed_float.iterkv() def test_iterkv_names(self):