Skip to content

Commit 4d0068e

Browse files
authored
CLN: Remove pandas.value_counts, Index.format, is_interval, is_period (#57296)
1 parent 203a661 commit 4d0068e

File tree

28 files changed

+17
-690
lines changed

28 files changed

+17
-690
lines changed

asv_bench/benchmarks/strftime.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,6 @@ def time_frame_period_formatting_default(self, nobs, freq):
7979
def time_frame_period_formatting_default_explicit(self, nobs, freq):
8080
self.data["p"].dt.strftime(date_format=self.default_fmt)
8181

82-
def time_frame_period_formatting_index_default(self, nobs, freq):
83-
self.data.index.format()
84-
85-
def time_frame_period_formatting_index_default_explicit(self, nobs, freq):
86-
self.data.index.format(self.default_fmt)
87-
8882
def time_frame_period_formatting_custom(self, nobs, freq):
8983
self.data["p"].dt.strftime(date_format="%Y-%m-%d --- %H:%M:%S")
9084

doc/redirects.csv

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ generated/pandas.api.types.is_int64_dtype,../reference/api/pandas.api.types.is_i
118118
generated/pandas.api.types.is_integer_dtype,../reference/api/pandas.api.types.is_integer_dtype
119119
generated/pandas.api.types.is_integer,../reference/api/pandas.api.types.is_integer
120120
generated/pandas.api.types.is_interval_dtype,../reference/api/pandas.api.types.is_interval_dtype
121-
generated/pandas.api.types.is_interval,../reference/api/pandas.api.types.is_interval
122121
generated/pandas.api.types.is_iterator,../reference/api/pandas.api.types.is_iterator
123122
generated/pandas.api.types.is_list_like,../reference/api/pandas.api.types.is_list_like
124123
generated/pandas.api.types.is_named_tuple,../reference/api/pandas.api.types.is_named_tuple

doc/source/reference/arrays.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -700,7 +700,6 @@ Scalar introspection
700700
api.types.is_float
701701
api.types.is_hashable
702702
api.types.is_integer
703-
api.types.is_interval
704703
api.types.is_number
705704
api.types.is_re
706705
api.types.is_re_compilable

doc/source/whatsnew/v3.0.0.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,15 @@ Removal of prior version deprecations/changes
108108
- Removed ``DataFrame.first`` and ``DataFrame.last`` (:issue:`53710`)
109109
- Removed ``DataFrameGroupBy.grouper`` and ``SeriesGroupBy.grouper`` (:issue:`56521`)
110110
- Removed ``DataFrameGroupby.fillna`` and ``SeriesGroupBy.fillna``` (:issue:`55719`)
111+
- Removed ``Index.format``, use :meth:`Index.astype` with ``str`` or :meth:`Index.map` with a ``formatter`` function instead (:issue:`55439`)
111112
- Removed ``Series.__int__`` and ``Series.__float__``. Call ``int(Series.iloc[0])`` or ``float(Series.iloc[0])`` instead. (:issue:`51131`)
112113
- Removed ``Series.ravel`` (:issue:`56053`)
113114
- Removed ``Series.view`` (:issue:`56054`)
114115
- Removed ``axis`` argument from :meth:`DataFrame.groupby`, :meth:`Series.groupby`, :meth:`DataFrame.rolling`, :meth:`Series.rolling`, :meth:`DataFrame.resample`, and :meth:`Series.resample` (:issue:`51203`)
115116
- Removed ``axis`` argument from all groupby operations (:issue:`50405`)
117+
- Removed ``pandas.api.types.is_interval`` and ``pandas.api.types.is_period``, use ``isinstance(obj, pd.Interval)`` and ``isinstance(obj, pd.Period)`` instead (:issue:`55264`)
116118
- Removed ``pandas.io.sql.execute`` (:issue:`50185`)
119+
- Removed ``pandas.value_counts``, use :meth:`Series.value_counts` instead (:issue:`53493`)
117120
- Removed ``read_gbq`` and ``DataFrame.to_gbq``. Use ``pandas_gbq.read_gbq`` and ``pandas_gbq.to_gbq`` instead https://pandas-gbq.readthedocs.io/en/latest/api.html (:issue:`55525`)
118121
- Removed deprecated argument ``obj`` in :meth:`.DataFrameGroupBy.get_group` and :meth:`.SeriesGroupBy.get_group` (:issue:`53545`)
119122
- Removed the ``ArrayManager`` (:issue:`55043`)

pandas/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@
101101
Grouper,
102102
factorize,
103103
unique,
104-
value_counts,
105104
NamedAgg,
106105
array,
107106
Categorical,
@@ -378,6 +377,5 @@
378377
"to_timedelta",
379378
"tseries",
380379
"unique",
381-
"value_counts",
382380
"wide_to_long",
383381
]

pandas/_libs/lib.pyi

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ from typing import (
1414

1515
import numpy as np
1616

17-
from pandas._libs.interval import Interval
18-
from pandas._libs.tslibs import Period
1917
from pandas._typing import (
2018
ArrayLike,
2119
DtypeObj,
@@ -44,8 +42,6 @@ def is_iterator(obj: object) -> bool: ...
4442
def is_scalar(val: object) -> bool: ...
4543
def is_list_like(obj: object, allow_sets: bool = ...) -> bool: ...
4644
def is_pyarrow_array(obj: object) -> bool: ...
47-
def is_period(val: object) -> TypeGuard[Period]: ...
48-
def is_interval(obj: object) -> TypeGuard[Interval]: ...
4945
def is_decimal(obj: object) -> TypeGuard[Decimal]: ...
5046
def is_complex(obj: object) -> TypeGuard[complex]: ...
5147
def is_bool(obj: object) -> TypeGuard[bool | np.bool_]: ...

pandas/_libs/lib.pyx

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1164,43 +1164,6 @@ cpdef bint is_decimal(object obj):
11641164
return isinstance(obj, Decimal)
11651165

11661166

1167-
cpdef bint is_interval(object obj):
1168-
import warnings
1169-
1170-
from pandas.util._exceptions import find_stack_level
1171-
1172-
warnings.warn(
1173-
# GH#55264
1174-
"is_interval is deprecated and will be removed in a future version. "
1175-
"Use isinstance(obj, pd.Interval) instead.",
1176-
FutureWarning,
1177-
stacklevel=find_stack_level(),
1178-
)
1179-
return getattr(obj, "_typ", "_typ") == "interval"
1180-
1181-
1182-
def is_period(val: object) -> bool:
1183-
"""
1184-
Return True if given object is Period.
1185-
1186-
Returns
1187-
-------
1188-
bool
1189-
"""
1190-
import warnings
1191-
1192-
from pandas.util._exceptions import find_stack_level
1193-
1194-
warnings.warn(
1195-
# GH#55264
1196-
"is_period is deprecated and will be removed in a future version. "
1197-
"Use isinstance(obj, pd.Period) instead.",
1198-
FutureWarning,
1199-
stacklevel=find_stack_level(),
1200-
)
1201-
return is_period_object(val)
1202-
1203-
12041167
def is_list_like(obj: object, allow_sets: bool = True) -> bool:
12051168
"""
12061169
Check if the object is list-like.

pandas/core/algorithms.py

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -818,53 +818,6 @@ def factorize(
818818
return codes, uniques
819819

820820

821-
def value_counts(
822-
values,
823-
sort: bool = True,
824-
ascending: bool = False,
825-
normalize: bool = False,
826-
bins=None,
827-
dropna: bool = True,
828-
) -> Series:
829-
"""
830-
Compute a histogram of the counts of non-null values.
831-
832-
Parameters
833-
----------
834-
values : ndarray (1-d)
835-
sort : bool, default True
836-
Sort by values
837-
ascending : bool, default False
838-
Sort in ascending order
839-
normalize: bool, default False
840-
If True then compute a relative histogram
841-
bins : integer, optional
842-
Rather than count values, group them into half-open bins,
843-
convenience for pd.cut, only works with numeric data
844-
dropna : bool, default True
845-
Don't include counts of NaN
846-
847-
Returns
848-
-------
849-
Series
850-
"""
851-
warnings.warn(
852-
# GH#53493
853-
"pandas.value_counts is deprecated and will be removed in a "
854-
"future version. Use pd.Series(obj).value_counts() instead.",
855-
FutureWarning,
856-
stacklevel=find_stack_level(),
857-
)
858-
return value_counts_internal(
859-
values,
860-
sort=sort,
861-
ascending=ascending,
862-
normalize=normalize,
863-
bins=bins,
864-
dropna=dropna,
865-
)
866-
867-
868821
def value_counts_internal(
869822
values,
870823
sort: bool = True,

pandas/core/api.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
from pandas.core.algorithms import (
2424
factorize,
2525
unique,
26-
value_counts,
2726
)
2827
from pandas.core.arrays import Categorical
2928
from pandas.core.arrays.boolean import BooleanDtype
@@ -136,5 +135,4 @@
136135
"UInt64Dtype",
137136
"UInt8Dtype",
138137
"unique",
139-
"value_counts",
140138
]

pandas/core/dtypes/api.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
is_int64_dtype,
2121
is_integer,
2222
is_integer_dtype,
23-
is_interval,
2423
is_interval_dtype,
2524
is_iterator,
2625
is_list_like,
@@ -63,7 +62,6 @@
6362
"is_int64_dtype",
6463
"is_integer",
6564
"is_integer_dtype",
66-
"is_interval",
6765
"is_interval_dtype",
6866
"is_iterator",
6967
"is_list_like",

0 commit comments

Comments
 (0)