Skip to content

Commit 2d0c961

Browse files
jbrockmendeljreback
authored andcommitted
CLN: De-privatize core.common funcs, remove unused (#22001)
1 parent c9f9ee3 commit 2d0c961

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+271
-477
lines changed

doc/source/whatsnew/v0.24.0.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ Removal of prior version deprecations/changes
390390
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
391391

392392
- The ``LongPanel`` and ``WidePanel`` classes have been removed (:issue:`10892`)
393-
-
393+
- Several private functions were removed from the (non-public) module ``pandas.core.common`` (:issue:`22001`)
394394
-
395395
-
396396

pandas/core/algorithms.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ def match(to_match, values, na_sentinel=-1):
262262
-------
263263
match : ndarray of integers
264264
"""
265-
values = com._asarray_tuplesafe(values)
265+
values = com.asarray_tuplesafe(values)
266266
htable, _, values, dtype, ndtype = _get_hashtable_algo(values)
267267
to_match, _, _ = _ensure_data(to_match, dtype)
268268
table = htable(min(len(to_match), 1000000))
@@ -412,7 +412,7 @@ def isin(comps, values):
412412
# handle categoricals
413413
return comps._values.isin(values)
414414

415-
comps = com._values_from_object(comps)
415+
comps = com.values_from_object(comps)
416416

417417
comps, dtype, _ = _ensure_data(comps)
418418
values, _, _ = _ensure_data(values, dtype=dtype)

pandas/core/arrays/categorical.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343

4444
import pandas.core.algorithms as algorithms
4545

46+
from pandas.io.formats import console
4647
from pandas.io.formats.terminal import get_terminal_size
4748
from pandas.util._validators import validate_bool_kwarg, validate_fillna_kwargs
4849
from pandas.core.config import get_option
@@ -1887,7 +1888,7 @@ def _repr_categories_info(self):
18871888
length=len(self.categories), dtype=dtype)
18881889
width, height = get_terminal_size()
18891890
max_width = get_option("display.width") or width
1890-
if com.in_ipython_frontend():
1891+
if console.in_ipython_frontend():
18911892
# 0 = no breaks
18921893
max_width = 0
18931894
levstring = ""

pandas/core/arrays/datetimes.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def wrapper(self, other):
120120
self._assert_tzawareness_compat(other)
121121

122122
result = meth(self, np.asarray(other))
123-
result = com._values_from_object(result)
123+
result = com.values_from_object(result)
124124

125125
# Make sure to pass an array to result[...]; indexing with
126126
# Series breaks with older version of numpy

pandas/core/arrays/interval.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -984,7 +984,7 @@ def __array__(self, dtype=None):
984984
examples='',
985985
))
986986
def to_tuples(self, na_tuple=True):
987-
tuples = com._asarray_tuplesafe(zip(self.left, self.right))
987+
tuples = com.asarray_tuplesafe(zip(self.left, self.right))
988988
if not na_tuple:
989989
# GH 18756
990990
tuples = np.where(~self.isna(), tuples, np.nan)

pandas/core/arrays/period.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ def _generate_range(cls, start, end, periods, freq, fields):
167167
freq = Period._maybe_convert_freq(freq)
168168

169169
field_count = len(fields)
170-
if com._count_not_none(start, end) > 0:
170+
if com.count_not_none(start, end) > 0:
171171
if field_count > 0:
172172
raise ValueError('Can either instantiate from fields '
173173
'or endpoints, but not both')
@@ -392,7 +392,7 @@ def _maybe_convert_timedelta(self, other):
392392
# Constructor Helpers
393393

394394
def _get_ordinal_range(start, end, periods, freq, mult=1):
395-
if com._count_not_none(start, end, periods) != 2:
395+
if com.count_not_none(start, end, periods) != 2:
396396
raise ValueError('Of the three parameters: start, end, and periods, '
397397
'exactly two must be specified')
398398

pandas/core/arrays/timedeltas.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def wrapper(self, other):
8181
else:
8282
other = type(self)(other).values
8383
result = meth(self, other)
84-
result = com._values_from_object(result)
84+
result = com.values_from_object(result)
8585

8686
o_mask = np.array(isna(other))
8787
if o_mask.any():
@@ -150,7 +150,7 @@ def __new__(cls, values, freq=None, start=None, end=None, periods=None,
150150
@classmethod
151151
def _generate_range(cls, start, end, periods, freq, closed=None, **kwargs):
152152
# **kwargs are for compat with TimedeltaIndex, which includes `name`
153-
if com._count_not_none(start, end, periods, freq) != 3:
153+
if com.count_not_none(start, end, periods, freq) != 3:
154154
raise ValueError('Of the four parameters: start, end, periods, '
155155
'and freq, exactly three must be specified')
156156

pandas/core/base.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ def _aggregate_multiple_funcs(self, arg, _level, _axis):
581581
results.append(colg.aggregate(a))
582582

583583
# make sure we find a good name
584-
name = com._get_callable_name(a) or a
584+
name = com.get_callable_name(a) or a
585585
keys.append(name)
586586
except (TypeError, DataError):
587587
pass
@@ -856,7 +856,7 @@ def tolist(self):
856856
numpy.ndarray.tolist
857857
"""
858858
if is_datetimelike(self._values):
859-
return [com._maybe_box_datetimelike(x) for x in self._values]
859+
return [com.maybe_box_datetimelike(x) for x in self._values]
860860
elif is_extension_array_dtype(self._values):
861861
return list(self._values)
862862
else:

0 commit comments

Comments
 (0)