Skip to content

Commit d282910

Browse files
jbrockmendelCloseChoice
authored andcommitted
CLN: remove BlockManager._get_counts, get_dtype_counts (pandas-dev#33599)
1 parent fb582e5 commit d282910

File tree

2 files changed

+1
-17
lines changed

2 files changed

+1
-17
lines changed

asv_bench/benchmarks/frame_methods.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,7 @@ def setup(self):
564564

565565
def time_frame_get_dtype_counts(self):
566566
with warnings.catch_warnings(record=True):
567-
self.df._data.get_dtype_counts()
567+
self.df.dtypes.value_counts()
568568

569569
def time_info(self):
570570
self.df.info()

pandas/core/internals/managers.py

-16
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ class BlockManager(PandasObject):
7474
set_axis(axis, new_labels)
7575
copy(deep=True)
7676
77-
get_dtype_counts
7877
get_dtypes
7978
8079
apply(func, axes, block_filter_fn)
@@ -256,18 +255,6 @@ def _rebuild_blknos_and_blklocs(self) -> None:
256255
def items(self) -> Index:
257256
return self.axes[0]
258257

259-
def _get_counts(self, f):
260-
""" return a dict of the counts of the function in BlockManager """
261-
self._consolidate_inplace()
262-
counts = dict()
263-
for b in self.blocks:
264-
v = f(b)
265-
counts[v] = counts.get(v, 0) + b.shape[0]
266-
return counts
267-
268-
def get_dtype_counts(self):
269-
return self._get_counts(lambda b: b.dtype.name)
270-
271258
def get_dtypes(self):
272259
dtypes = np.array([blk.dtype for blk in self.blocks])
273260
return algos.take_1d(dtypes, self.blknos, allow_fill=False)
@@ -1530,9 +1517,6 @@ def index(self) -> Index:
15301517
def dtype(self) -> DtypeObj:
15311518
return self._block.dtype
15321519

1533-
def get_dtype_counts(self):
1534-
return {self.dtype.name: 1}
1535-
15361520
def get_dtypes(self) -> np.ndarray:
15371521
return np.array([self._block.dtype])
15381522

0 commit comments

Comments
 (0)