<h4 dir="auto">Code Sample, a copy-pastable example if possible</h4>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="&gt;&gt;&gt; pr = pd.period_range(start='2017-01-01 00:00:00', periods=999999, freq='T')
&gt;&gt;&gt; df = pd.DataFrame({&quot;value&quot;: range(999999)}, index=pr)
&gt;&gt;&gt; df.loc[:&quot;2018-01-01 00:00&quot;]"><pre class="notranslate"><span class="pl-c1">&gt;&gt;</span><span class="pl-c1">&gt;</span> <span class="pl-s1">pr</span> <span class="pl-c1">=</span> <span class="pl-s1">pd</span>.<span class="pl-en">period_range</span>(<span class="pl-s1">start</span><span class="pl-c1">=</span><span class="pl-s">'2017-01-01 00:00:00'</span>, <span class="pl-s1">periods</span><span class="pl-c1">=</span><span class="pl-c1">999999</span>, <span class="pl-s1">freq</span><span class="pl-c1">=</span><span class="pl-s">'T'</span>)
<span class="pl-c1">&gt;&gt;</span><span class="pl-c1">&gt;</span> <span class="pl-s1">df</span> <span class="pl-c1">=</span> <span class="pl-s1">pd</span>.<span class="pl-v">DataFrame</span>({<span class="pl-s">"value"</span>: <span class="pl-en">range</span>(<span class="pl-c1">999999</span>)}, <span class="pl-s1">index</span><span class="pl-c1">=</span><span class="pl-s1">pr</span>)
<span class="pl-c1">&gt;&gt;</span><span class="pl-c1">&gt;</span> <span class="pl-s1">df</span>.<span class="pl-s1">loc</span>[:<span class="pl-s">"2018-01-01 00:00"</span>]</pre></div>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="                   value
2017-01-01 00:00       0
2017-01-01 00:01       1
2017-01-01 00:02       2
...
2017-12-31 23:59  525599
2018-01-01 00:00  525600"><pre class="notranslate"><code class="notranslate">                   value
2017-01-01 00:00       0
2017-01-01 00:01       1
2017-01-01 00:02       2
...
2017-12-31 23:59  525599
2018-01-01 00:00  525600
</code></pre></div>
<p dir="auto">Everything will be fine if the value of <code class="notranslate">periods</code> parameter is &lt; 1000000.</p>
<p dir="auto">So when I hit it with 1000000:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="&gt;&gt;&gt; pr = pd.period_range(start='2017-01-01 00:00:00', periods=1000000, freq='T')
&gt;&gt;&gt; df = pd.DataFrame({&quot;value&quot;: range(1000000)}, index=pr)
&gt;&gt;&gt; df.loc[:&quot;2018-01-01 00:00&quot;]"><pre class="notranslate"><span class="pl-c1">&gt;&gt;</span><span class="pl-c1">&gt;</span> <span class="pl-s1">pr</span> <span class="pl-c1">=</span> <span class="pl-s1">pd</span>.<span class="pl-en">period_range</span>(<span class="pl-s1">start</span><span class="pl-c1">=</span><span class="pl-s">'2017-01-01 00:00:00'</span>, <span class="pl-s1">periods</span><span class="pl-c1">=</span><span class="pl-c1">1000000</span>, <span class="pl-s1">freq</span><span class="pl-c1">=</span><span class="pl-s">'T'</span>)
<span class="pl-c1">&gt;&gt;</span><span class="pl-c1">&gt;</span> <span class="pl-s1">df</span> <span class="pl-c1">=</span> <span class="pl-s1">pd</span>.<span class="pl-v">DataFrame</span>({<span class="pl-s">"value"</span>: <span class="pl-en">range</span>(<span class="pl-c1">1000000</span>)}, <span class="pl-s1">index</span><span class="pl-c1">=</span><span class="pl-s1">pr</span>)
<span class="pl-c1">&gt;&gt;</span><span class="pl-c1">&gt;</span> <span class="pl-s1">df</span>.<span class="pl-s1">loc</span>[:<span class="pl-s">"2018-01-01 00:00"</span>]</pre></div>
<p dir="auto">Error occurs:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Traceback (most recent call last):
  File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;
  File &quot;/Users/violetvivirand/.local/share/virtualenvs/rewind-imputation-UYiSILLm/lib/python3.6/site-packages/pandas/core/indexing.py&quot;, line 1373, in __getitem__
    return self._getitem_axis(maybe_callable, axis=axis)
  File &quot;/Users/violetvivirand/.local/share/virtualenvs/rewind-imputation-UYiSILLm/lib/python3.6/site-packages/pandas/core/indexing.py&quot;, line 1581, in _getitem_axis
    return self._get_slice_axis(key, axis=axis)
  File &quot;/Users/violetvivirand/.local/share/virtualenvs/rewind-imputation-UYiSILLm/lib/python3.6/site-packages/pandas/core/indexing.py&quot;, line 1406, in _get_slice_axis
    slice_obj.step, kind=self.name)
  File &quot;/Users/violetvivirand/.local/share/virtualenvs/rewind-imputation-UYiSILLm/lib/python3.6/site-packages/pandas/core/indexes/base.py&quot;, line 3454, in slice_indexer
    kind=kind)
  File &quot;/Users/violetvivirand/.local/share/virtualenvs/rewind-imputation-UYiSILLm/lib/python3.6/site-packages/pandas/core/indexes/base.py&quot;, line 3661, in slice_locs
    end_slice = self.get_slice_bound(end, 'right', kind)
  File &quot;/Users/violetvivirand/.local/share/virtualenvs/rewind-imputation-UYiSILLm/lib/python3.6/site-packages/pandas/core/indexes/base.py&quot;, line 3585, in get_slice_bound
    slc = self._get_loc_only_exact_matches(label)
  File &quot;/Users/violetvivirand/.local/share/virtualenvs/rewind-imputation-UYiSILLm/lib/python3.6/site-packages/pandas/core/indexes/base.py&quot;, line 3554, in _get_loc_only_exact_matches
    return self.get_loc(key)
  File &quot;/Users/violetvivirand/.local/share/virtualenvs/rewind-imputation-UYiSILLm/lib/python3.6/site-packages/pandas/core/indexes/period.py&quot;, line 812, in get_loc
    return self._engine.get_loc(key)
  File &quot;pandas/_libs/index.pyx&quot;, line 117, in pandas._libs.index.IndexEngine.get_loc
  File &quot;pandas/_libs/index.pyx&quot;, line 125, in pandas._libs.index.IndexEngine.get_loc
  File &quot;pandas/_libs/index.pyx&quot;, line 365, in pandas._libs.index._bin_search
  File &quot;pandas/_libs/period.pyx&quot;, line 717, in pandas._libs.period._Period.__richcmp__
TypeError: Cannot compare type 'Period' with type 'int64'"><pre class="notranslate"><code class="notranslate">Traceback (most recent call last):
  File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  File "/Users/violetvivirand/.local/share/virtualenvs/rewind-imputation-UYiSILLm/lib/python3.6/site-packages/pandas/core/indexing.py", line 1373, in __getitem__
    return self._getitem_axis(maybe_callable, axis=axis)
  File "/Users/violetvivirand/.local/share/virtualenvs/rewind-imputation-UYiSILLm/lib/python3.6/site-packages/pandas/core/indexing.py", line 1581, in _getitem_axis
    return self._get_slice_axis(key, axis=axis)
  File "/Users/violetvivirand/.local/share/virtualenvs/rewind-imputation-UYiSILLm/lib/python3.6/site-packages/pandas/core/indexing.py", line 1406, in _get_slice_axis
    slice_obj.step, kind=self.name)
  File "/Users/violetvivirand/.local/share/virtualenvs/rewind-imputation-UYiSILLm/lib/python3.6/site-packages/pandas/core/indexes/base.py", line 3454, in slice_indexer
    kind=kind)
  File "/Users/violetvivirand/.local/share/virtualenvs/rewind-imputation-UYiSILLm/lib/python3.6/site-packages/pandas/core/indexes/base.py", line 3661, in slice_locs
    end_slice = self.get_slice_bound(end, 'right', kind)
  File "/Users/violetvivirand/.local/share/virtualenvs/rewind-imputation-UYiSILLm/lib/python3.6/site-packages/pandas/core/indexes/base.py", line 3585, in get_slice_bound
    slc = self._get_loc_only_exact_matches(label)
  File "/Users/violetvivirand/.local/share/virtualenvs/rewind-imputation-UYiSILLm/lib/python3.6/site-packages/pandas/core/indexes/base.py", line 3554, in _get_loc_only_exact_matches
    return self.get_loc(key)
  File "/Users/violetvivirand/.local/share/virtualenvs/rewind-imputation-UYiSILLm/lib/python3.6/site-packages/pandas/core/indexes/period.py", line 812, in get_loc
    return self._engine.get_loc(key)
  File "pandas/_libs/index.pyx", line 117, in pandas._libs.index.IndexEngine.get_loc
  File "pandas/_libs/index.pyx", line 125, in pandas._libs.index.IndexEngine.get_loc
  File "pandas/_libs/index.pyx", line 365, in pandas._libs.index._bin_search
  File "pandas/_libs/period.pyx", line 717, in pandas._libs.period._Period.__richcmp__
TypeError: Cannot compare type 'Period' with type 'int64'
</code></pre></div>
<h4 dir="auto">Problem description</h4>
<p dir="auto">Don't know what causes the error when the amount of PeriodIndex is more than 1000000. It should work without any problem, isn't it <g-emoji class="g-emoji" alias="confused" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/1f615.png">😕</g-emoji><g-emoji class="g-emoji" alias="question" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/2753.png">❓</g-emoji></p>
<h4 dir="auto">Expected Output</h4>
<p dir="auto">It should returns the data from <strong>2017-01-01 00:00</strong> to <strong>2018-01-01 00:00</strong>:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="                   value
2017-01-01 00:00       0
2017-01-01 00:01       1
2017-01-01 00:02       2
...
2017-12-31 23:59  525599
2018-01-01 00:00  525600"><pre class="notranslate"><code class="notranslate">                   value
2017-01-01 00:00       0
2017-01-01 00:01       1
2017-01-01 00:02       2
...
2017-12-31 23:59  525599
2018-01-01 00:00  525600
</code></pre></div>
<h4 dir="auto">Output of <code class="notranslate">pd.show_versions()</code></h4>
<details>
<h2 dir="auto">INSTALLED VERSIONS</h2>
<p dir="auto">commit: None<br>
python: 3.6.0.final.0<br>
python-bits: 64<br>
OS: Darwin<br>
OS-release: 16.7.0<br>
machine: x86_64<br>
processor: i386<br>
byteorder: little<br>
LC_ALL: None<br>
LANG: zh_TW.UTF-8<br>
LOCALE: zh_TW.UTF-8</p>
<p dir="auto">pandas: 0.21.0<br>
pytest: None<br>
pip: 9.0.1<br>
setuptools: 36.6.0<br>
Cython: None<br>
numpy: 1.13.3<br>
scipy: None<br>
pyarrow: None<br>
xarray: None<br>
IPython: 6.2.1<br>
sphinx: None<br>
patsy: None<br>
dateutil: 2.6.1<br>
pytz: 2017.3<br>
blosc: None<br>
bottleneck: None<br>
tables: None<br>
numexpr: None<br>
feather: None<br>
matplotlib: None<br>
openpyxl: None<br>
xlrd: None<br>
xlwt: None<br>
xlsxwriter: None<br>
lxml: None<br>
bs4: None<br>
html5lib: None<br>
sqlalchemy: None<br>
pymysql: None<br>
psycopg2: None<br>
jinja2: None<br>
s3fs: None<br>
fastparquet: None<br>
pandas_gbq: None<br>
pandas_datareader: None</p>
</details>
<p dir="auto">use max_seq_len, after setting default to close <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="13359426" data-permission-text="Title is private" data-url="https://github.com/pandas-dev/pandas/issues/3391" data-hovercard-type="issue" data-hovercard-url="/pandas-dev/pandas/issues/3391/hovercard" href="https://github.com/pandas-dev/pandas/issues/3391">#3391</a>.<br>
also duplicate behaviour of "..." in other situations, rather then<br>
always printing 6 items</p>