Skip to content

Commit 363cba2

Browse files
committed
pandas.hashtable -> pandas.libs.hashtable
1 parent c9bed7b commit 363cba2

18 files changed

+29
-36
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
tseries: pandas/libs/lib.pyx pandas/libs/tslib.pyx pandas/hashtable.pyx
1+
tseries: pandas/libs/lib.pyx pandas/libs/tslib.pyx pandas/libs/hashtable.pyx
22
python setup.py build_ext --inplace
33

44
.PHONY : develop build clean clean_pyc tseries doc

doc/source/whatsnew/v0.20.0.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,7 @@ If indicated, a deprecation warning will be issued if you reference that module.
469469
"pandas.index", "pandas.libs.index", ""
470470
"pandas.algos", "pandas.libs.algos", ""
471471
"pandas.lib", "pandas.libs.lib", "X"
472+
"pandas.hastable", "pandas.libs.hashtable", ""
472473

473474

474475
.. _whatsnew_0200.api_breaking.groupby_describe:

pandas/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@
2323
from pandas.compat.numpy import *
2424

2525
try:
26-
from pandas import hashtable
27-
from pandas.libs import lib as _lib, tslib as _tslib
26+
from pandas.libs import (hashtable as _hashtable,
27+
lib as _lib,
28+
tslib as _tslib)
2829
except ImportError as e: # pragma: no cover
2930
# hack but overkill to use re
3031
module = str(e).lstrip('cannot import name ')

pandas/core/algorithms.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,8 @@
3434
from pandas.types.missing import isnull
3535

3636
import pandas.core.common as com
37-
import pandas.hashtable as htable
3837
from pandas.compat import string_types
39-
from pandas.libs import algos, lib
38+
from pandas.libs import algos, lib, hashtable as htable
4039
from pandas.libs.tslib import iNaT
4140

4241

pandas/core/categorical.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1890,7 +1890,7 @@ def mode(self):
18901890
modes : `Categorical` (sorted)
18911891
"""
18921892

1893-
import pandas.hashtable as htable
1893+
import pandas.libs.hashtable as htable
18941894
good = self._codes != -1
18951895
values = sorted(htable.mode_int64(_ensure_int64(self._codes[good])))
18961896
result = self._constructor(values=values, categories=self.categories,

pandas/core/frame.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3170,7 +3170,7 @@ def duplicated(self, subset=None, keep='first'):
31703170
duplicated : Series
31713171
"""
31723172
from pandas.core.sorting import get_group_index
3173-
from pandas.hashtable import duplicated_int64, _SIZE_HINT_LIMIT
3173+
from pandas.libs.hashtable import duplicated_int64, _SIZE_HINT_LIMIT
31743174

31753175
def f(vals):
31763176
labels, shape = algos.factorize(vals,

pandas/core/sorting.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
is_categorical_dtype)
99
from pandas.types.missing import isnull
1010
import pandas.core.algorithms as algos
11-
from pandas.libs import lib, algos as _algos
12-
import pandas.hashtable as _hash
11+
from pandas.libs import lib, algos as _algos, hashtable as _hash
12+
from pandas.libs.hashtable import unique_label_indices
1313

1414

1515
_INT64_MAX = np.iinfo(np.int64).max
@@ -130,7 +130,6 @@ def decons_obs_group_ids(comp_ids, obs_ids, shape, labels, xnull):
130130
xnull: boolean,
131131
if nulls are excluded; i.e. -1 labels are passed through
132132
"""
133-
from pandas.hashtable import unique_label_indices
134133

135134
if not xnull:
136135
lift = np.fromiter(((a == -1).any() for a in labels), dtype='i8')

pandas/indexes/category.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ def unique(self):
303303
False: 'first'})
304304
@Appender(base._shared_docs['duplicated'] % _index_doc_kwargs)
305305
def duplicated(self, keep='first'):
306-
from pandas.hashtable import duplicated_int64
306+
from pandas.libs.hashtable import duplicated_int64
307307
codes = self.codes.astype('i8')
308308
return duplicated_int64(codes, keep)
309309

pandas/indexes/multi.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
from sys import getsizeof
77

88
import numpy as np
9-
import pandas.libs.lib as lib
10-
import pandas.libs.index as _index
9+
from pandas.libs import index as _index, lib
1110
from pandas.libs.lib import Timestamp
1211

1312
from pandas.compat import range, zip, lrange, lzip, map
@@ -762,7 +761,7 @@ def f(k, stringify):
762761
@Appender(base._shared_docs['duplicated'] % _index_doc_kwargs)
763762
def duplicated(self, keep='first'):
764763
from pandas.core.sorting import get_group_index
765-
from pandas.hashtable import duplicated_int64
764+
from pandas.libs.hashtable import duplicated_int64
766765

767766
shape = map(len, self.levels)
768767
ids = get_group_index(self.labels, shape, sort=False, xnull=False)
File renamed without changes.
File renamed without changes.

pandas/libs/index.pyx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,8 @@ cimport util
1616
import numpy as np
1717

1818
cimport tslib
19-
from ..hashtable cimport *
20-
from pandas import hashtable as _hash
21-
from pandas.libs import tslib, algos
19+
from hashtable cimport *
20+
from pandas.libs import tslib, algos, hashtable as _hash
2221
from pandas.libs.tslib import Timestamp, Timedelta
2322

2423
from datetime cimport (get_datetime64_value, _pydatetime_to_dts,

pandas/src/joins_func_helper.pxi.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ on_dtypes = ['uint8_t', 'uint16_t', 'uint32_t', 'uint64_t',
2323
}}
2424

2525

26-
from hashtable cimport *
26+
from libs.hashtable cimport *
2727

2828
{{for table_type, by_dtype in by_dtypes}}
2929
{{for on_dtype in on_dtypes}}

pandas/tests/api/test_api.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,6 @@ class TestPDApi(Base, tm.TestCase):
3636
'test', 'tools', 'tseries', 'sparse',
3737
'types', 'util', 'options', 'io', 'libs']
3838

39-
# top-level packages that are c-imports, should rename to _*
40-
# to avoid naming conflicts
41-
lib_to_rename = ['hashtable']
42-
4339
# these are already deprecated; awaiting removal
4440
deprecated_modules = ['stats', 'datetools', 'parser', 'json', 'lib']
4541

@@ -118,7 +114,7 @@ class TestPDApi(Base, tm.TestCase):
118114
def test_api(self):
119115

120116
self.check(pd,
121-
self.lib + self.lib_to_rename + self.misc +
117+
self.lib + self.misc +
122118
self.modules + self.deprecated_modules +
123119
self.classes + self.deprecated_classes +
124120
self.deprecated_classes_in_future +

pandas/tests/indexes/test_multi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2182,7 +2182,7 @@ def check(nlevels, with_nulls):
21822182

21832183
for keep in ['first', 'last', False]:
21842184
left = mi.duplicated(keep=keep)
2185-
right = pd.hashtable.duplicated_object(mi.values, keep=keep)
2185+
right = pd.libs.hashtable.duplicated_object(mi.values, keep=keep)
21862186
tm.assert_numpy_array_equal(left, right)
21872187

21882188
# GH5873

pandas/tests/test_algos.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
import pandas as pd
1111

1212
from pandas import compat
13-
import pandas.libs.algos as _algos
13+
from pandas.libs import algos as _algos, hashtable
14+
from pandas.libs.hashtable import unique_label_indices
1415
from pandas.compat import lrange
1516
import pandas.core.algorithms as algos
1617
import pandas.util.testing as tm
17-
import pandas.hashtable as hashtable
1818
from pandas.compat.numpy import np_array_datetime64_compat
1919
from pandas.util.testing import assert_almost_equal
2020

@@ -972,7 +972,6 @@ def test_quantile():
972972

973973

974974
def test_unique_label_indices():
975-
from pandas.hashtable import unique_label_indices
976975

977976
a = np.random.randint(1, 1 << 10, 1 << 15).astype('i8')
978977

pandas/tools/merge.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
import pandas.core.common as com
4040

4141
import pandas._join as _join
42-
import pandas.hashtable as _hash
42+
from pandas.libs import hashtable as _hash
4343

4444

4545
# back-compat of pseudo-public API

setup.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ class CheckSDist(sdist_class):
327327
"""Custom sdist that ensures Cython has compiled all pyx files to c."""
328328

329329
_pyxfiles = ['pandas/lib.pyx',
330-
'pandas/hashtable.pyx',
330+
'pandas/libs/hashtable.pyx',
331331
'pandas/libs/tslib.pyx',
332332
'pandas/libs/index.pyx',
333333
'pandas/libs/algos.pyx',
@@ -474,10 +474,10 @@ def pxd(name):
474474
'libs.lib': {'pyxfile': 'libs/lib',
475475
'pxdfiles': [],
476476
'depends': lib_depends},
477-
'hashtable': {'pyxfile': 'hashtable',
478-
'pxdfiles': ['hashtable'],
479-
'depends': (['pandas/src/klib/khash_python.h']
480-
+ _pxi_dep['hashtable'])},
477+
'libs.hashtable': {'pyxfile': 'libs/hashtable',
478+
'pxdfiles': ['libs/hashtable'],
479+
'depends': (['pandas/src/klib/khash_python.h']
480+
+ _pxi_dep['hashtable'])},
481481
'libs.tslib': {'pyxfile': 'libs/tslib',
482482
'depends': tseries_depends,
483483
'sources': ['pandas/src/datetime/np_datetime.c',
@@ -491,13 +491,13 @@ def pxd(name):
491491
'libs.index': {'pyxfile': 'libs/index',
492492
'sources': ['pandas/src/datetime/np_datetime.c',
493493
'pandas/src/datetime/np_datetime_strings.c'],
494-
'pxdfiles': ['src/util', 'hashtable'],
494+
'pxdfiles': ['src/util', 'libs/hashtable'],
495495
'depends': _pxi_dep['index']},
496496
'libs.algos': {'pyxfile': 'libs/algos',
497-
'pxdfiles': ['src/util', 'hashtable'],
497+
'pxdfiles': ['src/util', 'libs/hashtable'],
498498
'depends': _pxi_dep['algos']},
499499
'_join': {'pyxfile': 'src/join',
500-
'pxdfiles': ['src/util', 'hashtable'],
500+
'pxdfiles': ['src/util', 'libs/hashtable'],
501501
'depends': _pxi_dep['join']},
502502
'_window': {'pyxfile': 'window',
503503
'pxdfiles': ['src/skiplist', 'src/util'],

0 commit comments

Comments
 (0)