Skip to content

CLN: remove BlockManager._get_counts, get_dtype_counts #33599

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion asv_bench/benchmarks/frame_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ def setup(self):

def time_frame_get_dtype_counts(self):
with warnings.catch_warnings(record=True):
self.df._data.get_dtype_counts()
self.df.dtypes.value_counts()

def time_info(self):
self.df.info()
Expand Down
16 changes: 0 additions & 16 deletions pandas/core/internals/managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ class BlockManager(PandasObject):
set_axis(axis, new_labels)
copy(deep=True)

get_dtype_counts
get_dtypes

apply(func, axes, block_filter_fn)
Expand Down Expand Up @@ -256,18 +255,6 @@ def _rebuild_blknos_and_blklocs(self) -> None:
def items(self) -> Index:
return self.axes[0]

def _get_counts(self, f):
""" return a dict of the counts of the function in BlockManager """
self._consolidate_inplace()
counts = dict()
for b in self.blocks:
v = f(b)
counts[v] = counts.get(v, 0) + b.shape[0]
return counts

def get_dtype_counts(self):
return self._get_counts(lambda b: b.dtype.name)

def get_dtypes(self):
dtypes = np.array([blk.dtype for blk in self.blocks])
return algos.take_1d(dtypes, self.blknos, allow_fill=False)
Expand Down Expand Up @@ -1530,9 +1517,6 @@ def index(self) -> Index:
def dtype(self) -> DtypeObj:
return self._block.dtype

def get_dtype_counts(self):
return {self.dtype.name: 1}

def get_dtypes(self) -> np.ndarray:
return np.array([self._block.dtype])

Expand Down