/usr/local/lib64/python3.6/site-packages/pandas/tests/indexes/period
NameSizeModeActions
__pycache__/-0755rm
test_asfreq.py54320644editdlrm
test_astype.py61890644editdlrm
test_constructors.py198310644editdlrm
test_factorize.py12670644editdlrm
test_fillna.py11040644editdlrm
test_formats.py69710644editdlrm
test_indexing.py290170644editdlrm
test_join.py14100644editdlrm
test_monotonic.py12450644editdlrm
test_ops.py126420644editdlrm
test_partial_slicing.py53230644editdlrm
test_period.py214620644editdlrm
test_period_range.py39540644editdlrm
test_scalar_compat.py11230644editdlrm
test_searchsorted.py26220644editdlrm
test_setops.py120870644editdlrm
test_shift.py43980644editdlrm
test_tools.py10060644editdlrm
test_to_timestamp.py36120644editdlrm
__init__.py00644editdlrm
Edit: /usr/local/lib64/python3.6/site-packages/pandas/tests/indexes/period/test_factorize.py (1267B)
import numpy as np from pandas import PeriodIndex import pandas._testing as tm class TestFactorize: def test_factorize(self): idx1 = PeriodIndex( ["2014-01", "2014-01", "2014-02", "2014-02", "2014-03", "2014-03"], freq="M" ) exp_arr = np.array([0, 0, 1, 1, 2, 2], dtype=np.intp) exp_idx = PeriodIndex(["2014-01", "2014-02", "2014-03"], freq="M") arr, idx = idx1.factorize() tm.assert_numpy_array_equal(arr, exp_arr) tm.assert_index_equal(idx, exp_idx) arr, idx = idx1.factorize(sort=True) tm.assert_numpy_array_equal(arr, exp_arr) tm.assert_index_equal(idx, exp_idx) idx2 = PeriodIndex( ["2014-03", "2014-03", "2014-02", "2014-01", "2014-03", "2014-01"], freq="M" ) exp_arr = np.array([2, 2, 1, 0, 2, 0], dtype=np.intp) arr, idx = idx2.factorize(sort=True) tm.assert_numpy_array_equal(arr, exp_arr) tm.assert_index_equal(idx, exp_idx) exp_arr = np.array([0, 0, 1, 2, 0, 2], dtype=np.intp) exp_idx = PeriodIndex(["2014-03", "2014-02", "2014-01"], freq="M") arr, idx = idx2.factorize() tm.assert_numpy_array_equal(arr, exp_arr) tm.assert_index_equal(idx, exp_idx)