Skip to content

Commit 687cbe2

Browse files
GGordonGordonTomAugspurger
authored andcommitted
DEPR: deprecate get_ftype_counts (GH18243) (#20404)
1 parent 1b1b99b commit 687cbe2

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

doc/source/whatsnew/v0.23.0.txt

+1
Original file line numberDiff line numberDiff line change
@@ -744,6 +744,7 @@ Deprecations
744744

745745
- ``pandas.tseries.plotting.tsplot`` is deprecated. Use :func:`Series.plot` instead (:issue:`18627`)
746746
- ``Index.summary()`` is deprecated and will be removed in a future version (:issue:`18217`)
747+
- ``NDFrame.get_ftype_counts()`` is deprecated and will be removed in a future version (:issue:`18243`)
747748

748749
.. _whatsnew_0230.prior_deprecations:
749750

pandas/core/generic.py

+6
Original file line numberDiff line numberDiff line change
@@ -4726,6 +4726,8 @@ def get_ftype_counts(self):
47264726
"""
47274727
Return counts of unique ftypes in this object.
47284728
4729+
.. deprecated:: 0.23.0
4730+
47294731
This is useful for SparseDataFrame or for DataFrames containing
47304732
sparse arrays.
47314733
@@ -4756,6 +4758,10 @@ def get_ftype_counts(self):
47564758
object:dense 1
47574759
dtype: int64
47584760
"""
4761+
warnings.warn("get_ftype_counts is deprecated and will "
4762+
"be removed in a future version",
4763+
FutureWarning, stacklevel=2)
4764+
47594765
from pandas import Series
47604766
return Series(self._data.get_ftype_counts())
47614767

pandas/tests/series/test_dtypes.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,10 @@ def test_dtype(self):
6464
assert self.ts.ftypes == 'float64:dense'
6565
tm.assert_series_equal(self.ts.get_dtype_counts(),
6666
Series(1, ['float64']))
67-
tm.assert_series_equal(self.ts.get_ftype_counts(),
68-
Series(1, ['float64:dense']))
67+
# GH18243 - Assert .get_ftype_counts is deprecated
68+
with tm.assert_produces_warning(FutureWarning):
69+
tm.assert_series_equal(self.ts.get_ftype_counts(),
70+
Series(1, ['float64:dense']))
6971

7072
@pytest.mark.parametrize("value", [np.nan, np.inf])
7173
@pytest.mark.parametrize("dtype", [np.int32, np.int64])

0 commit comments

Comments
 (0)