Skip to content
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

CLN: move tools.hashing to util.hashing #16086

Merged
merged 1 commit into from
Apr 21, 2017
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
22 changes: 13 additions & 9 deletions asv_bench/benchmarks/algorithms.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
from importlib import import_module

import numpy as np

import pandas as pd
from pandas.util import testing as tm

try:
from pandas.tools.hashing import hash_pandas_object
except ImportError:
pass

for imp in ['pandas.util.hashing', 'pandas.tools.hashing']:
try:
hashing = import_module(imp)
break
except:
pass

class Algorithms(object):
goal_time = 0.2
Expand Down Expand Up @@ -108,13 +112,13 @@ def setup(self):
self.df.iloc[10:20] = np.nan

def time_frame(self):
hash_pandas_object(self.df)
hashing.hash_pandas_object(self.df)

def time_series_int(self):
hash_pandas_object(self.df.E)
hashing.hash_pandas_object(self.df.E)

def time_series_string(self):
hash_pandas_object(self.df.B)
hashing.hash_pandas_object(self.df.B)

def time_series_categorical(self):
hash_pandas_object(self.df.C)
hashing.hash_pandas_object(self.df.C)
6 changes: 3 additions & 3 deletions doc/source/whatsnew/v0.20.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ Other Enhancements
- ``pd.merge_asof()`` gained the option ``direction='backward'|'forward'|'nearest'`` (:issue:`14887`)
- ``Series/DataFrame.asfreq()`` have gained a ``fill_value`` parameter, to fill missing values (:issue:`3715`).
- ``Series/DataFrame.resample.asfreq`` have gained a ``fill_value`` parameter, to fill missing values during resampling (:issue:`3715`).
- ``pandas.tools.hashing`` has gained a ``hash_tuples`` routine, and ``hash_pandas_object`` has gained the ability to hash a ``MultiIndex`` (:issue:`15224`)
- ``pandas.util.hashing`` has gained a ``hash_tuples`` routine, and ``hash_pandas_object`` has gained the ability to hash a ``MultiIndex`` (:issue:`15224`)
- ``Series/DataFrame.squeeze()`` have gained the ``axis`` parameter. (:issue:`15339`)
- ``DataFrame.to_excel()`` has a new ``freeze_panes`` parameter to turn on Freeze Panes when exporting to Excel (:issue:`15160`)
- ``pd.read_html()`` will parse multiple header rows, creating a multiindex header. (:issue:`13434`).
Expand Down Expand Up @@ -1423,7 +1423,7 @@ If indicated, a deprecation warning will be issued if you reference theses modul
"pandas.types", "pandas.core.dtypes", ""
"pandas.io.sas.saslib", "pandas.io.sas.libsas", ""
"pandas._join", "pandas._libs.join", ""
"pandas._hash", "pandas.tools.libhash", ""
"pandas._hash", "pandas.util.libhashing", ""
"pandas._period", "pandas._libs.period", ""
"pandas._sparse", "pandas.core.sparse.libsparse", ""
"pandas._testing", "pandas.util.libtesting", ""
Expand Down Expand Up @@ -1619,7 +1619,7 @@ I/O
- Bug in ``pd.read_csv()`` for the Python engine in which unhelpful error messages were being raised when parsing errors occurred (:issue:`15910`)
- Bug in ``pd.read_csv()`` in which the ``skipfooter`` parameter was not being properly validated (:issue:`15925`)
- Bug in ``pd.to_csv()`` in which there was numeric overflow when a timestamp index was being written (:issue:`15982`)
- Bug in ``pd.tools.hashing.hash_pandas_object()`` in which hashing of categoricals depended on the ordering of categories, instead of just their values. (:issue:`15143`)
- Bug in ``pd.util.hashing.hash_pandas_object()`` in which hashing of categoricals depended on the ordering of categories, instead of just their values. (:issue:`15143`)
- Bug in ``.to_json()`` where ``lines=True`` and contents (keys or values) contain escaped characters (:issue:`15096`)
- Bug in ``.to_json()`` causing single byte ascii characters to be expanded to four byte unicode (:issue:`15344`)
- Bug in ``.to_json()`` for the C engine where rollover was not correctly handled for case where frac is odd and diff is exactly 0.5 (:issue:`15716`, :issue:`15864`)
Expand Down
4 changes: 2 additions & 2 deletions pandas/core/indexes/multi.py
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,7 @@ def _inferred_type_levels(self):
@cache_readonly
def _hashed_values(self):
""" return a uint64 ndarray of my hashed values """
from pandas.tools.hashing import hash_tuples
from pandas.util.hashing import hash_tuples
return hash_tuples(self)

def _hashed_indexing_key(self, key):
Expand All @@ -740,7 +740,7 @@ def _hashed_indexing_key(self, key):
we need to stringify if we have mixed levels

"""
from pandas.tools.hashing import hash_tuples
from pandas.util.hashing import hash_tuples

if not isinstance(key, tuple):
return hash_tuples(key)
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/reshape/test_hashing.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import pandas as pd

from pandas import DataFrame, Series, Index, MultiIndex
from pandas.tools.hashing import hash_array, hash_tuples, hash_pandas_object
from pandas.util.hashing import hash_array, hash_tuples, hash_pandas_object
import pandas.util.testing as tm


Expand Down
2 changes: 1 addition & 1 deletion pandas/tools/hashing.py → pandas/util/hashing.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import numpy as np
from pandas import Series, factorize, Categorical, Index, MultiIndex
from pandas.tools import libhashing as _hash
from pandas.util import libhashing as _hash
from pandas._libs.lib import is_bool_array
from pandas.core.dtypes.generic import (
ABCIndexClass,
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -528,8 +528,8 @@ def pxd(name):
_pxi_dep['sparse'])},
'util.libtesting': {'pyxfile': 'util/testing',
'depends': ['pandas/util/testing.pyx']},
'tools.libhashing': {'pyxfile': 'tools/hashing',
'depends': ['pandas/tools/hashing.pyx']},
'util.libhashing': {'pyxfile': 'util/hashing',
'depends': ['pandas/util/hashing.pyx']},
'io.sas.libsas': {'pyxfile': 'io/sas/sas'},
}

Expand Down