|
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 |
|
@@ -2806,8 +2805,8 @@ def _reindex_multi(self, axes, copy, fill_value):
|
2806 | 2805 |
|
2807 | 2806 | if row_indexer is not None and col_indexer is not None:
|
2808 | 2807 | indexer = row_indexer, col_indexer
|
2809 |
| - new_values = algos.take_2d_multi(self.values, indexer, |
2810 |
| - fill_value=fill_value) |
| 2808 | + new_values = algorithms.take_2d_multi(self.values, indexer, |
| 2809 | + fill_value=fill_value) |
2811 | 2810 | return self._constructor(new_values, index=new_index,
|
2812 | 2811 | columns=new_columns)
|
2813 | 2812 | else:
|
@@ -3192,12 +3191,11 @@ def duplicated(self, subset=None, keep='first'):
|
3192 | 3191 | duplicated : Series
|
3193 | 3192 | """
|
3194 | 3193 | from pandas.core.sorting import get_group_index
|
3195 |
| - from pandas.hashtable import duplicated_int64, _SIZE_HINT_LIMIT |
| 3194 | + from pandas.libs.hashtable import duplicated_int64, _SIZE_HINT_LIMIT |
3196 | 3195 |
|
3197 | 3196 | def f(vals):
|
3198 |
| - labels, shape = algos.factorize(vals, |
3199 |
| - size_hint=min(len(self), |
3200 |
| - _SIZE_HINT_LIMIT)) |
| 3197 | + labels, shape = algorithms.factorize( |
| 3198 | + vals, size_hint=min(len(self), _SIZE_HINT_LIMIT)) |
3201 | 3199 | return labels.astype('i8', copy=False), len(shape)
|
3202 | 3200 |
|
3203 | 3201 | if subset is None:
|
@@ -3449,7 +3447,7 @@ def nlargest(self, n, columns, keep='first'):
|
3449 | 3447 | 1 10 b 2
|
3450 | 3448 | 2 8 d NaN
|
3451 | 3449 | """
|
3452 |
| - return algos.select_n_frame(self, columns, n, 'nlargest', keep) |
| 3450 | + return algorithms.select_n_frame(self, columns, n, 'nlargest', keep) |
3453 | 3451 |
|
3454 | 3452 | def nsmallest(self, n, columns, keep='first'):
|
3455 | 3453 | """Get the rows of a DataFrame sorted by the `n` smallest
|
@@ -3483,7 +3481,7 @@ def nsmallest(self, n, columns, keep='first'):
|
3483 | 3481 | 0 1 a 1
|
3484 | 3482 | 2 8 d NaN
|
3485 | 3483 | """
|
3486 |
| - return algos.select_n_frame(self, columns, n, 'nsmallest', keep) |
| 3484 | + return algorithms.select_n_frame(self, columns, n, 'nsmallest', keep) |
3487 | 3485 |
|
3488 | 3486 | def swaplevel(self, i=-2, j=-1, axis=0):
|
3489 | 3487 | """
|
@@ -4751,10 +4749,10 @@ def corr(self, method='pearson', min_periods=1):
|
4751 | 4749 | mat = numeric_df.values
|
4752 | 4750 |
|
4753 | 4751 | if method == 'pearson':
|
4754 |
| - correl = _algos.nancorr(_ensure_float64(mat), minp=min_periods) |
| 4752 | + correl = libalgos.nancorr(_ensure_float64(mat), minp=min_periods) |
4755 | 4753 | elif method == 'spearman':
|
4756 |
| - correl = _algos.nancorr_spearman(_ensure_float64(mat), |
4757 |
| - minp=min_periods) |
| 4754 | + correl = libalgos.nancorr_spearman(_ensure_float64(mat), |
| 4755 | + minp=min_periods) |
4758 | 4756 | else:
|
4759 | 4757 | if min_periods is None:
|
4760 | 4758 | min_periods = 1
|
@@ -4814,8 +4812,8 @@ def cov(self, min_periods=None):
|
4814 | 4812 | baseCov = np.cov(mat.T)
|
4815 | 4813 | baseCov = baseCov.reshape((len(cols), len(cols)))
|
4816 | 4814 | else:
|
4817 |
| - baseCov = _algos.nancorr(_ensure_float64(mat), cov=True, |
4818 |
| - minp=min_periods) |
| 4815 | + baseCov = libalgos.nancorr(_ensure_float64(mat), cov=True, |
| 4816 | + minp=min_periods) |
4819 | 4817 |
|
4820 | 4818 | return self._constructor(baseCov, index=idx, columns=cols)
|
4821 | 4819 |
|
@@ -5681,7 +5679,7 @@ def _list_of_series_to_arrays(data, columns, coerce_float=False, dtype=None):
|
5681 | 5679 | indexer = indexer_cache[id(index)] = index.get_indexer(columns)
|
5682 | 5680 |
|
5683 | 5681 | values = _values_from_object(s)
|
5684 |
| - aligned_values.append(algos.take_1d(values, indexer)) |
| 5682 | + aligned_values.append(algorithms.take_1d(values, indexer)) |
5685 | 5683 |
|
5686 | 5684 | values = np.vstack(aligned_values)
|
5687 | 5685 |
|
|
0 commit comments