@@ -172,16 +172,7 @@ class NDFrame(PandasObject, SelectionMixin):
172172 _internal_names_set = set (_internal_names ) # type: Set[str]
173173 _accessors = set () # type: Set[str]
174174 _deprecations = frozenset (
175- [
176- "clip_lower" ,
177- "clip_upper" ,
178- "get_dtype_counts" ,
179- "get_ftype_counts" ,
180- "get_values" ,
181- "is_copy" ,
182- "ftypes" ,
183- "ix" ,
184- ]
175+ ["get_dtype_counts" , "get_values" , "ftypes" , "ix" ]
185176 ) # type: FrozenSet[str]
186177 _metadata = [] # type: List[str]
187178 _is_copy = None
@@ -252,29 +243,6 @@ def attrs(self) -> Dict[Optional[Hashable], Any]:
252243 def attrs (self , value : Mapping [Optional [Hashable ], Any ]) -> None :
253244 self ._attrs = dict (value )
254245
255- @property
256- def is_copy (self ):
257- """
258- Return the copy.
259- """
260- warnings .warn (
261- "Attribute 'is_copy' is deprecated and will be removed "
262- "in a future version." ,
263- FutureWarning ,
264- stacklevel = 2 ,
265- )
266- return self ._is_copy
267-
268- @is_copy .setter
269- def is_copy (self , msg ):
270- warnings .warn (
271- "Attribute 'is_copy' is deprecated and will be removed "
272- "in a future version." ,
273- FutureWarning ,
274- stacklevel = 2 ,
275- )
276- self ._is_copy = msg
277-
278246 def _validate_dtype (self , dtype ):
279247 """ validate the passed dtype """
280248
@@ -5595,49 +5563,6 @@ def get_dtype_counts(self):
55955563
55965564 return Series (self ._data .get_dtype_counts ())
55975565
5598- def get_ftype_counts (self ):
5599- """
5600- Return counts of unique ftypes in this object.
5601-
5602- .. deprecated:: 0.23.0
5603-
5604- Returns
5605- -------
5606- dtype : Series
5607- Series with the count of columns with each type and
5608- sparsity (dense/sparse).
5609-
5610- See Also
5611- --------
5612- ftypes : Return ftypes (indication of sparse/dense and dtype) in
5613- this object.
5614-
5615- Examples
5616- --------
5617- >>> a = [['a', 1, 1.0], ['b', 2, 2.0], ['c', 3, 3.0]]
5618- >>> df = pd.DataFrame(a, columns=['str', 'int', 'float'])
5619- >>> df
5620- str int float
5621- 0 a 1 1.0
5622- 1 b 2 2.0
5623- 2 c 3 3.0
5624-
5625- >>> df.get_ftype_counts() # doctest: +SKIP
5626- float64:dense 1
5627- int64:dense 1
5628- object:dense 1
5629- dtype: int64
5630- """
5631- warnings .warn (
5632- "get_ftype_counts is deprecated and will be removed in a future version" ,
5633- FutureWarning ,
5634- stacklevel = 2 ,
5635- )
5636-
5637- from pandas import Series
5638-
5639- return Series (self ._data .get_ftype_counts ())
5640-
56415566 @property
56425567 def dtypes (self ):
56435568 """
@@ -7526,208 +7451,6 @@ def clip(self, lower=None, upper=None, axis=None, inplace=False, *args, **kwargs
75267451
75277452 return result
75287453
7529- def clip_upper (self , threshold , axis = None , inplace = False ):
7530- """
7531- Trim values above a given threshold.
7532-
7533- .. deprecated:: 0.24.0
7534- Use clip(upper=threshold) instead.
7535-
7536- Elements above the `threshold` will be changed to match the
7537- `threshold` value(s). Threshold can be a single value or an array,
7538- in the latter case it performs the truncation element-wise.
7539-
7540- Parameters
7541- ----------
7542- threshold : numeric or array-like
7543- Maximum value allowed. All values above threshold will be set to
7544- this value.
7545-
7546- * float : every value is compared to `threshold`.
7547- * array-like : The shape of `threshold` should match the object
7548- it's compared to. When `self` is a Series, `threshold` should be
7549- the length. When `self` is a DataFrame, `threshold` should 2-D
7550- and the same shape as `self` for ``axis=None``, or 1-D and the
7551- same length as the axis being compared.
7552-
7553- axis : {0 or 'index', 1 or 'columns'}, default 0
7554- Align object with `threshold` along the given axis.
7555- inplace : bool, default False
7556- Whether to perform the operation in place on the data.
7557-
7558- .. versionadded:: 0.21.0
7559-
7560- Returns
7561- -------
7562- Series or DataFrame
7563- Original data with values trimmed.
7564-
7565- See Also
7566- --------
7567- Series.clip : General purpose method to trim Series values to given
7568- threshold(s).
7569- DataFrame.clip : General purpose method to trim DataFrame values to
7570- given threshold(s).
7571-
7572- Examples
7573- --------
7574- >>> s = pd.Series([1, 2, 3, 4, 5])
7575- >>> s
7576- 0 1
7577- 1 2
7578- 2 3
7579- 3 4
7580- 4 5
7581- dtype: int64
7582-
7583- >>> s.clip(upper=3)
7584- 0 1
7585- 1 2
7586- 2 3
7587- 3 3
7588- 4 3
7589- dtype: int64
7590-
7591- >>> elemwise_thresholds = [5, 4, 3, 2, 1]
7592- >>> elemwise_thresholds
7593- [5, 4, 3, 2, 1]
7594-
7595- >>> s.clip(upper=elemwise_thresholds)
7596- 0 1
7597- 1 2
7598- 2 3
7599- 3 2
7600- 4 1
7601- dtype: int64
7602- """
7603- warnings .warn (
7604- "clip_upper(threshold) is deprecated, use clip(upper=threshold) instead" ,
7605- FutureWarning ,
7606- stacklevel = 2 ,
7607- )
7608- return self ._clip_with_one_bound (
7609- threshold , method = self .le , axis = axis , inplace = inplace
7610- )
7611-
7612- def clip_lower (self , threshold , axis = None , inplace = False ):
7613- """
7614- Trim values below a given threshold.
7615-
7616- .. deprecated:: 0.24.0
7617- Use clip(lower=threshold) instead.
7618-
7619- Elements below the `threshold` will be changed to match the
7620- `threshold` value(s). Threshold can be a single value or an array,
7621- in the latter case it performs the truncation element-wise.
7622-
7623- Parameters
7624- ----------
7625- threshold : numeric or array-like
7626- Minimum value allowed. All values below threshold will be set to
7627- this value.
7628-
7629- * float : every value is compared to `threshold`.
7630- * array-like : The shape of `threshold` should match the object
7631- it's compared to. When `self` is a Series, `threshold` should be
7632- the length. When `self` is a DataFrame, `threshold` should 2-D
7633- and the same shape as `self` for ``axis=None``, or 1-D and the
7634- same length as the axis being compared.
7635-
7636- axis : {0 or 'index', 1 or 'columns'}, default 0
7637- Align `self` with `threshold` along the given axis.
7638-
7639- inplace : bool, default False
7640- Whether to perform the operation in place on the data.
7641-
7642- .. versionadded:: 0.21.0
7643-
7644- Returns
7645- -------
7646- Series or DataFrame
7647- Original data with values trimmed.
7648-
7649- See Also
7650- --------
7651- Series.clip : General purpose method to trim Series values to given
7652- threshold(s).
7653- DataFrame.clip : General purpose method to trim DataFrame values to
7654- given threshold(s).
7655-
7656- Examples
7657- --------
7658-
7659- Series single threshold clipping:
7660-
7661- >>> s = pd.Series([5, 6, 7, 8, 9])
7662- >>> s.clip(lower=8)
7663- 0 8
7664- 1 8
7665- 2 8
7666- 3 8
7667- 4 9
7668- dtype: int64
7669-
7670- Series clipping element-wise using an array of thresholds. `threshold`
7671- should be the same length as the Series.
7672-
7673- >>> elemwise_thresholds = [4, 8, 7, 2, 5]
7674- >>> s.clip(lower=elemwise_thresholds)
7675- 0 5
7676- 1 8
7677- 2 7
7678- 3 8
7679- 4 9
7680- dtype: int64
7681-
7682- DataFrames can be compared to a scalar.
7683-
7684- >>> df = pd.DataFrame({"A": [1, 3, 5], "B": [2, 4, 6]})
7685- >>> df
7686- A B
7687- 0 1 2
7688- 1 3 4
7689- 2 5 6
7690-
7691- >>> df.clip(lower=3)
7692- A B
7693- 0 3 3
7694- 1 3 4
7695- 2 5 6
7696-
7697- Or to an array of values. By default, `threshold` should be the same
7698- shape as the DataFrame.
7699-
7700- >>> df.clip(lower=np.array([[3, 4], [2, 2], [6, 2]]))
7701- A B
7702- 0 3 4
7703- 1 3 4
7704- 2 6 6
7705-
7706- Control how `threshold` is broadcast with `axis`. In this case
7707- `threshold` should be the same length as the axis specified by
7708- `axis`.
7709-
7710- >>> df.clip(lower=[3, 3, 5], axis='index')
7711- A B
7712- 0 3 3
7713- 1 3 4
7714- 2 5 6
7715-
7716- >>> df.clip(lower=[4, 5], axis='columns')
7717- A B
7718- 0 4 5
7719- 1 4 5
7720- 2 5 6
7721- """
7722- warnings .warn (
7723- "clip_lower(threshold) is deprecated, use clip(lower=threshold) instead" ,
7724- FutureWarning ,
7725- stacklevel = 2 ,
7726- )
7727- return self ._clip_with_one_bound (
7728- threshold , method = self .ge , axis = axis , inplace = inplace
7729- )
7730-
77317454 def groupby (
77327455 self ,
77337456 by = None ,
0 commit comments