|
71 | 71 | from pandas.core.series import Series
|
72 | 72 | from pandas.core.categorical import Categorical
|
73 | 73 | import pandas.computation.expressions as expressions
|
74 |
| -import pandas.core.algorithms as algos |
| 74 | +import pandas.core.algorithms as algorithms |
75 | 75 | from pandas.computation.eval import eval as _eval
|
76 | 76 | from pandas.compat import (range, map, zip, lrange, lmap, lzip, StringIO, u,
|
77 | 77 | OrderedDict, raise_with_traceback)
|
|
93 | 93 | from pandas.formats.printing import pprint_thing
|
94 | 94 | import pandas.tools.plotting as gfx
|
95 | 95 |
|
96 |
| -import pandas.lib as lib |
97 |
| -import pandas.algos as _algos |
| 96 | +from pandas.libs import lib, algos as libalgos |
98 | 97 |
|
99 | 98 | from pandas.core.config import get_option
|
100 | 99 |
|
@@ -2776,8 +2775,8 @@ def _reindex_multi(self, axes, copy, fill_value):
|
2776 | 2775 |
|
2777 | 2776 | if row_indexer is not None and col_indexer is not None:
|
2778 | 2777 | indexer = row_indexer, col_indexer
|
2779 |
| - new_values = algos.take_2d_multi(self.values, indexer, |
2780 |
| - fill_value=fill_value) |
| 2778 | + new_values = algorithms.take_2d_multi(self.values, indexer, |
| 2779 | + fill_value=fill_value) |
2781 | 2780 | return self._constructor(new_values, index=new_index,
|
2782 | 2781 | columns=new_columns)
|
2783 | 2782 | else:
|
@@ -3162,12 +3161,11 @@ def duplicated(self, subset=None, keep='first'):
|
3162 | 3161 | duplicated : Series
|
3163 | 3162 | """
|
3164 | 3163 | from pandas.core.sorting import get_group_index
|
3165 |
| - from pandas.hashtable import duplicated_int64, _SIZE_HINT_LIMIT |
| 3164 | + from pandas.libs.hashtable import duplicated_int64, _SIZE_HINT_LIMIT |
3166 | 3165 |
|
3167 | 3166 | def f(vals):
|
3168 |
| - labels, shape = algos.factorize(vals, |
3169 |
| - size_hint=min(len(self), |
3170 |
| - _SIZE_HINT_LIMIT)) |
| 3167 | + labels, shape = algorithms.factorize( |
| 3168 | + vals, size_hint=min(len(self), _SIZE_HINT_LIMIT)) |
3171 | 3169 | return labels.astype('i8', copy=False), len(shape)
|
3172 | 3170 |
|
3173 | 3171 | if subset is None:
|
@@ -3419,7 +3417,7 @@ def nlargest(self, n, columns, keep='first'):
|
3419 | 3417 | 1 10 b 2
|
3420 | 3418 | 2 8 d NaN
|
3421 | 3419 | """
|
3422 |
| - return algos.select_n_frame(self, columns, n, 'nlargest', keep) |
| 3420 | + return algorithms.select_n_frame(self, columns, n, 'nlargest', keep) |
3423 | 3421 |
|
3424 | 3422 | def nsmallest(self, n, columns, keep='first'):
|
3425 | 3423 | """Get the rows of a DataFrame sorted by the `n` smallest
|
@@ -3453,7 +3451,7 @@ def nsmallest(self, n, columns, keep='first'):
|
3453 | 3451 | 0 1 a 1
|
3454 | 3452 | 2 8 d NaN
|
3455 | 3453 | """
|
3456 |
| - return algos.select_n_frame(self, columns, n, 'nsmallest', keep) |
| 3454 | + return algorithms.select_n_frame(self, columns, n, 'nsmallest', keep) |
3457 | 3455 |
|
3458 | 3456 | def swaplevel(self, i=-2, j=-1, axis=0):
|
3459 | 3457 | """
|
@@ -4721,10 +4719,10 @@ def corr(self, method='pearson', min_periods=1):
|
4721 | 4719 | mat = numeric_df.values
|
4722 | 4720 |
|
4723 | 4721 | if method == 'pearson':
|
4724 |
| - correl = _algos.nancorr(_ensure_float64(mat), minp=min_periods) |
| 4722 | + correl = libalgos.nancorr(_ensure_float64(mat), minp=min_periods) |
4725 | 4723 | elif method == 'spearman':
|
4726 |
| - correl = _algos.nancorr_spearman(_ensure_float64(mat), |
4727 |
| - minp=min_periods) |
| 4724 | + correl = libalgos.nancorr_spearman(_ensure_float64(mat), |
| 4725 | + minp=min_periods) |
4728 | 4726 | else:
|
4729 | 4727 | if min_periods is None:
|
4730 | 4728 | min_periods = 1
|
@@ -4784,8 +4782,8 @@ def cov(self, min_periods=None):
|
4784 | 4782 | baseCov = np.cov(mat.T)
|
4785 | 4783 | baseCov = baseCov.reshape((len(cols), len(cols)))
|
4786 | 4784 | else:
|
4787 |
| - baseCov = _algos.nancorr(_ensure_float64(mat), cov=True, |
4788 |
| - minp=min_periods) |
| 4785 | + baseCov = libalgos.nancorr(_ensure_float64(mat), cov=True, |
| 4786 | + minp=min_periods) |
4789 | 4787 |
|
4790 | 4788 | return self._constructor(baseCov, index=idx, columns=cols)
|
4791 | 4789 |
|
@@ -5651,7 +5649,7 @@ def _list_of_series_to_arrays(data, columns, coerce_float=False, dtype=None):
|
5651 | 5649 | indexer = indexer_cache[id(index)] = index.get_indexer(columns)
|
5652 | 5650 |
|
5653 | 5651 | values = _values_from_object(s)
|
5654 |
| - aligned_values.append(algos.take_1d(values, indexer)) |
| 5652 | + aligned_values.append(algorithms.take_1d(values, indexer)) |
5655 | 5653 |
|
5656 | 5654 | values = np.vstack(aligned_values)
|
5657 | 5655 |
|
|
0 commit comments