<h4 dir="auto">Code Sample</h4>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="In [19]: dates = pd.period_range('20100101','20100105', freq='D')

In [20]: weights = pd.DataFrame(np.random.randn(5, 5), index=dates, columns = ['g1_%d' % x for x in range(5)])

In [21]: weights.join(pd.DataFrame(np.random.randn(5,5), index=dates, columns = ['g2_%d' % x for x in range(5)]))
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
&lt;ipython-input-21-2fdb8b02f5a4&gt; in &lt;module&gt;()
      1 weights.join(
----&gt; 2             pd.DataFrame(np.random.randn(5,5), index=dates, columns = ['g2_%d' % x for x in range(5)]))

/usr/local/lib/python2.7/dist-packages/pandas/core/frame.pyc in join(self, other, on, how, lsuffix, rsuffix, sort)
   4765         # For SparseDataFrame's benefit
   4766         return self._join_compat(other, on=on, how=how, lsuffix=lsuffix,
-&gt; 4767                                  rsuffix=rsuffix, sort=sort)
   4768
   4769     def _join_compat(self, other, on=None, how='left', lsuffix='', rsuffix='',

/usr/local/lib/python2.7/dist-packages/pandas/core/frame.pyc in _join_compat(self, other, on, how, lsuffix, rsuffix, sort)
   4780             return merge(self, other, left_on=on, how=how,
   4781                          left_index=on is None, right_index=True,
-&gt; 4782                          suffixes=(lsuffix, rsuffix), sort=sort)
   4783         else:
   4784             if on is not None:

/usr/local/lib/python2.7/dist-packages/pandas/core/reshape/merge.pyc in merge(left, right, how, on, left_on, right_on, left_index, right_index, sort, suffixes, copy, indicator)
     52                          right_index=right_index, sort=sort, suffixes=suffixes,
     53                          copy=copy, indicator=indicator)
---&gt; 54     return op.get_result()
     55
     56

/usr/local/lib/python2.7/dist-packages/pandas/core/reshape/merge.pyc in get_result(self)
    567                 self.left, self.right)
    568
--&gt; 569         join_index, left_indexer, right_indexer = self._get_join_info()
    570
    571         ldata, rdata = self.left._data, self.right._data

/usr/local/lib/python2.7/dist-packages/pandas/core/reshape/merge.pyc in _get_join_info(self)
    720             join_index, left_indexer, right_indexer = \
    721                 left_ax.join(right_ax, how=self.how, return_indexers=True,
--&gt; 722                              sort=self.sort)
    723         elif self.right_index and self.how == 'left':
    724             join_index, left_indexer, right_indexer = \

TypeError: join() got an unexpected keyword argument 'sort'
"><pre class="notranslate"><span class="pl-v">In</span> [<span class="pl-c1">19</span>]: <span class="pl-s1">dates</span> <span class="pl-c1">=</span> <span class="pl-s1">pd</span>.<span class="pl-en">period_range</span>(<span class="pl-s">'20100101'</span>,<span class="pl-s">'20100105'</span>, <span class="pl-s1">freq</span><span class="pl-c1">=</span><span class="pl-s">'D'</span>)

<span class="pl-v">In</span> [<span class="pl-c1">20</span>]: <span class="pl-s1">weights</span> <span class="pl-c1">=</span> <span class="pl-s1">pd</span>.<span class="pl-v">DataFrame</span>(<span class="pl-s1">np</span>.<span class="pl-s1">random</span>.<span class="pl-en">randn</span>(<span class="pl-c1">5</span>, <span class="pl-c1">5</span>), <span class="pl-s1">index</span><span class="pl-c1">=</span><span class="pl-s1">dates</span>, <span class="pl-s1">columns</span> <span class="pl-c1">=</span> [<span class="pl-s">'g1_%d'</span> <span class="pl-c1">%</span> <span class="pl-s1">x</span> <span class="pl-k">for</span> <span class="pl-s1">x</span> <span class="pl-c1">in</span> <span class="pl-en">range</span>(<span class="pl-c1">5</span>)])

<span class="pl-v">In</span> [<span class="pl-c1">21</span>]: <span class="pl-s1">weights</span>.<span class="pl-en">join</span>(<span class="pl-s1">pd</span>.<span class="pl-v">DataFrame</span>(<span class="pl-s1">np</span>.<span class="pl-s1">random</span>.<span class="pl-en">randn</span>(<span class="pl-c1">5</span>,<span class="pl-c1">5</span>), <span class="pl-s1">index</span><span class="pl-c1">=</span><span class="pl-s1">dates</span>, <span class="pl-s1">columns</span> <span class="pl-c1">=</span> [<span class="pl-s">'g2_%d'</span> <span class="pl-c1">%</span> <span class="pl-s1">x</span> <span class="pl-k">for</span> <span class="pl-s1">x</span> <span class="pl-c1">in</span> <span class="pl-en">range</span>(<span class="pl-c1">5</span>)]))
<span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span>
<span class="pl-v">TypeError</span>                                 <span class="pl-v">Traceback</span> (<span class="pl-s1">most</span> <span class="pl-s1">recent</span> <span class="pl-s1">call</span> <span class="pl-s1">last</span>)
<span class="pl-c1">&lt;</span><span class="pl-s1">ipython</span><span class="pl-c1">-</span><span class="pl-s1">input</span><span class="pl-c1">-</span><span class="pl-c1">21</span><span class="pl-c1">-</span><span class="pl-c1">2</span><span class="pl-s1">fdb8b02f5a4</span><span class="pl-c1">&gt;</span> <span class="pl-s1">in</span> <span class="pl-c1">&lt;</span><span class="pl-s1">module</span><span class="pl-c1">&gt;</span>()
      <span class="pl-c1">1</span> <span class="pl-s1">weights</span>.<span class="pl-en">join</span>(
<span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-c1">2</span>             <span class="pl-s1">pd</span>.<span class="pl-v">DataFrame</span>(<span class="pl-s1">np</span>.<span class="pl-s1">random</span>.<span class="pl-en">randn</span>(<span class="pl-c1">5</span>,<span class="pl-c1">5</span>), <span class="pl-s1">index</span><span class="pl-c1">=</span><span class="pl-s1">dates</span>, <span class="pl-s1">columns</span> <span class="pl-c1">=</span> [<span class="pl-s">'g2_%d'</span> <span class="pl-c1">%</span> <span class="pl-s1">x</span> <span class="pl-k">for</span> <span class="pl-s1">x</span> <span class="pl-c1">in</span> <span class="pl-en">range</span>(<span class="pl-c1">5</span>)]))

<span class="pl-c1">/</span><span class="pl-s1">usr</span><span class="pl-c1">/</span><span class="pl-s1">local</span><span class="pl-c1">/</span><span class="pl-s1">lib</span><span class="pl-c1">/</span><span class="pl-s1">python2</span>.<span class="pl-c1">7</span><span class="pl-c1">/</span><span class="pl-s1">dist</span><span class="pl-c1">-</span><span class="pl-s1">packages</span><span class="pl-c1">/</span><span class="pl-s1">pandas</span><span class="pl-c1">/</span><span class="pl-s1">core</span><span class="pl-c1">/</span><span class="pl-s1">frame</span>.<span class="pl-s1">pyc</span> <span class="pl-c1">in</span> <span class="pl-en">join</span>(<span class="pl-s1">self</span>, <span class="pl-s1">other</span>, <span class="pl-s1">on</span>, <span class="pl-s1">how</span>, <span class="pl-s1">lsuffix</span>, <span class="pl-s1">rsuffix</span>, <span class="pl-s1">sort</span>)
   <span class="pl-c1">4765</span>         <span class="pl-c"># For SparseDataFrame's benefit</span>
   <span class="pl-c1">4766</span>         <span class="pl-k">return</span> <span class="pl-s1">self</span>.<span class="pl-en">_join_compat</span>(<span class="pl-s1">other</span>, <span class="pl-s1">on</span><span class="pl-c1">=</span><span class="pl-s1">on</span>, <span class="pl-s1">how</span><span class="pl-c1">=</span><span class="pl-s1">how</span>, <span class="pl-s1">lsuffix</span><span class="pl-c1">=</span><span class="pl-s1">lsuffix</span>,
<span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-c1">4767</span>                                  <span class="pl-s1">rsuffix</span><span class="pl-c1">=</span><span class="pl-s1">rsuffix</span>, <span class="pl-s1">sort</span><span class="pl-c1">=</span><span class="pl-s1">sort</span>)
   <span class="pl-c1">4768</span>
   <span class="pl-c1">4769</span>     <span class="pl-k">def</span> <span class="pl-s1">_join_compat</span>(<span class="pl-s1">self</span>, <span class="pl-s1">other</span>, <span class="pl-s1">on</span><span class="pl-c1">=</span><span class="pl-c1">None</span>, <span class="pl-s1">how</span><span class="pl-c1">=</span><span class="pl-s">'left'</span>, <span class="pl-s1">lsuffix</span><span class="pl-c1">=</span><span class="pl-s">''</span>, <span class="pl-s1">rsuffix</span><span class="pl-c1">=</span><span class="pl-s">''</span>,

<span class="pl-c1">/</span><span class="pl-s1">usr</span><span class="pl-c1">/</span><span class="pl-s1">local</span><span class="pl-c1">/</span><span class="pl-s1">lib</span><span class="pl-c1">/</span><span class="pl-s1">python2</span><span class="pl-c1">.7</span><span class="pl-c1">/</span><span class="pl-s1">dist</span><span class="pl-c1">-</span><span class="pl-s1">packages</span><span class="pl-c1">/</span><span class="pl-s1">pandas</span><span class="pl-c1">/</span><span class="pl-s1">core</span><span class="pl-c1">/</span><span class="pl-s1">frame</span>.<span class="pl-s1">pyc</span> <span class="pl-c1">in</span> <span class="pl-s1">_join_compat</span>(<span class="pl-s1">self</span>, <span class="pl-s1">other</span>, <span class="pl-s1">on</span>, <span class="pl-s1">how</span>, <span class="pl-s1">lsuffix</span>, <span class="pl-s1">rsuffix</span>, <span class="pl-s1">sort</span>)
   <span class="pl-c1">4780</span>             <span class="pl-k">return</span> <span class="pl-en">merge</span>(<span class="pl-s1">self</span>, <span class="pl-s1">other</span>, <span class="pl-s1">left_on</span><span class="pl-c1">=</span><span class="pl-s1">on</span>, <span class="pl-s1">how</span><span class="pl-c1">=</span><span class="pl-s1">how</span>,
   <span class="pl-c1">4781</span>                          <span class="pl-s1">left_index</span><span class="pl-c1">=</span><span class="pl-s1">on</span> <span class="pl-c1">is</span> <span class="pl-c1">None</span>, <span class="pl-s1">right_index</span><span class="pl-c1">=</span><span class="pl-c1">True</span>,
<span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-c1">4782</span>                          <span class="pl-s1">suffixes</span><span class="pl-c1">=</span>(<span class="pl-s1">lsuffix</span>, <span class="pl-s1">rsuffix</span>), <span class="pl-s1">sort</span><span class="pl-c1">=</span><span class="pl-s1">sort</span>)
   <span class="pl-c1">4783</span>         <span class="pl-s1">else</span>:
   <span class="pl-c1">4784</span>             <span class="pl-k">if</span> <span class="pl-s1">on</span> <span class="pl-c1">is</span> <span class="pl-c1">not</span> <span class="pl-c1">None</span>:

<span class="pl-c1">/</span><span class="pl-s1">usr</span><span class="pl-c1">/</span><span class="pl-s1">local</span><span class="pl-c1">/</span><span class="pl-s1">lib</span><span class="pl-c1">/</span><span class="pl-s1">python2</span>.<span class="pl-c1">7</span><span class="pl-c1">/</span><span class="pl-s1">dist</span><span class="pl-c1">-</span><span class="pl-s1">packages</span><span class="pl-c1">/</span><span class="pl-s1">pandas</span><span class="pl-c1">/</span><span class="pl-s1">core</span><span class="pl-c1">/</span><span class="pl-s1">reshape</span><span class="pl-c1">/</span><span class="pl-s1">merge</span>.<span class="pl-s1">pyc</span> <span class="pl-c1">in</span> <span class="pl-en">merge</span>(<span class="pl-s1">left</span>, <span class="pl-s1">right</span>, <span class="pl-s1">how</span>, <span class="pl-s1">on</span>, <span class="pl-s1">left_on</span>, <span class="pl-s1">right_on</span>, <span class="pl-s1">left_index</span>, <span class="pl-s1">right_index</span>, <span class="pl-s1">sort</span>, <span class="pl-s1">suffixes</span>, <span class="pl-s1">copy</span>, <span class="pl-s1">indicator</span>)
     <span class="pl-c1">52</span>                          <span class="pl-s1">right_index</span><span class="pl-c1">=</span><span class="pl-s1">right_index</span>, <span class="pl-s1">sort</span><span class="pl-c1">=</span><span class="pl-s1">sort</span>, <span class="pl-s1">suffixes</span><span class="pl-c1">=</span><span class="pl-s1">suffixes</span>,
     <span class="pl-c1">53</span>                          <span class="pl-s1">copy</span><span class="pl-c1">=</span><span class="pl-s1">copy</span>, <span class="pl-s1">indicator</span><span class="pl-c1">=</span><span class="pl-s1">indicator</span>)
<span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-c1">54</span>     <span class="pl-s1">return</span> <span class="pl-s1">op</span>.<span class="pl-en">get_result</span>()
     <span class="pl-c1">55</span>
     <span class="pl-c1">56</span>

<span class="pl-c1">/</span><span class="pl-s1">usr</span><span class="pl-c1">/</span><span class="pl-s1">local</span><span class="pl-c1">/</span><span class="pl-s1">lib</span><span class="pl-c1">/</span><span class="pl-s1">python2</span>.<span class="pl-c1">7</span><span class="pl-c1">/</span><span class="pl-s1">dist</span><span class="pl-c1">-</span><span class="pl-s1">packages</span><span class="pl-c1">/</span><span class="pl-s1">pandas</span><span class="pl-c1">/</span><span class="pl-s1">core</span><span class="pl-c1">/</span><span class="pl-s1">reshape</span><span class="pl-c1">/</span><span class="pl-s1">merge</span>.<span class="pl-s1">pyc</span> <span class="pl-c1">in</span> <span class="pl-en">get_result</span>(<span class="pl-s1">self</span>)
    <span class="pl-c1">567</span>                 <span class="pl-s1">self</span>.<span class="pl-s1">left</span>, <span class="pl-s1">self</span>.<span class="pl-s1">right</span>)
    <span class="pl-c1">568</span>
<span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-c1">569</span>         <span class="pl-s1">join_index</span>, <span class="pl-s1">left_indexer</span>, <span class="pl-s1">right_indexer</span> <span class="pl-c1">=</span> <span class="pl-s1">self</span>.<span class="pl-en">_get_join_info</span>()
    <span class="pl-c1">570</span>
    <span class="pl-c1">571</span>         <span class="pl-s1">ldata</span>, <span class="pl-s1">rdata</span> <span class="pl-c1">=</span> <span class="pl-s1">self</span>.<span class="pl-s1">left</span>.<span class="pl-s1">_data</span>, <span class="pl-s1">self</span>.<span class="pl-s1">right</span>.<span class="pl-s1">_data</span>

<span class="pl-c1">/</span><span class="pl-s1">usr</span><span class="pl-c1">/</span><span class="pl-s1">local</span><span class="pl-c1">/</span><span class="pl-s1">lib</span><span class="pl-c1">/</span><span class="pl-s1">python2</span>.<span class="pl-c1">7</span><span class="pl-c1">/</span><span class="pl-s1">dist</span><span class="pl-c1">-</span><span class="pl-s1">packages</span><span class="pl-c1">/</span><span class="pl-s1">pandas</span><span class="pl-c1">/</span><span class="pl-s1">core</span><span class="pl-c1">/</span><span class="pl-s1">reshape</span><span class="pl-c1">/</span><span class="pl-s1">merge</span>.<span class="pl-s1">pyc</span> <span class="pl-c1">in</span> <span class="pl-en">_get_join_info</span>(<span class="pl-s1">self</span>)
    <span class="pl-c1">720</span>             <span class="pl-s1">join_index</span>, <span class="pl-s1">left_indexer</span>, <span class="pl-s1">right_indexer</span> <span class="pl-c1">=</span> \
    <span class="pl-c1">721</span>                 <span class="pl-s1">left_ax</span>.<span class="pl-en">join</span>(<span class="pl-s1">right_ax</span>, <span class="pl-s1">how</span><span class="pl-c1">=</span><span class="pl-s1">self</span>.<span class="pl-s1">how</span>, <span class="pl-s1">return_indexers</span><span class="pl-c1">=</span><span class="pl-c1">True</span>,
<span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-c1">722</span>                              <span class="pl-s1">sort</span><span class="pl-c1">=</span><span class="pl-s1">self</span>.<span class="pl-s1">sort</span>)
    <span class="pl-c1">723</span>         <span class="pl-k">elif</span> <span class="pl-s1">self</span>.<span class="pl-s1">right_index</span> <span class="pl-c1">and</span> <span class="pl-s1">self</span>.<span class="pl-s1">how</span> <span class="pl-c1">==</span> <span class="pl-s">'left'</span>:
    <span class="pl-c1">724</span>             <span class="pl-s1">join_index</span>, <span class="pl-s1">left_indexer</span>, <span class="pl-s1">right_indexer</span> <span class="pl-c1">=</span> \

<span class="pl-v">TypeError</span>: <span class="pl-en">join</span>() <span class="pl-s1">got</span> <span class="pl-s1">an</span> <span class="pl-s1">unexpected</span> <span class="pl-s1">keyword</span> <span class="pl-s1">argument</span> <span class="pl-s">'sort'</span></pre></div>
<p dir="auto">It seems the sort kwarg is invalid, but the internals are passing it in regardless</p>
<h4 dir="auto">Output of <code class="notranslate">pd.show_versions()</code></h4>
<details>
In [22]: pd.show_versions()
/usr/local/lib/python2.7/dist-packages/xarray/core/formatting.py:16: FutureWarning: The pandas.tslib module is deprecated and will be removed in a future version.
  from pandas.tslib import OutOfBoundsDatetime
<h2 dir="auto">INSTALLED VERSIONS</h2>
<p dir="auto">commit: None<br>
python: 2.7.12.final.0<br>
python-bits: 64<br>
OS: Linux<br>
OS-release: 4.9.13-moby<br>
machine: x86_64<br>
processor: x86_64<br>
byteorder: little<br>
LC_ALL: None<br>
LANG: None<br>
LOCALE: None.None</p>
<p dir="auto">pandas: 0.20.1<br>
pytest: 3.0.7<br>
pip: 9.0.1<br>
setuptools: 35.0.2<br>
Cython: 0.25.2<br>
numpy: 1.12.1<br>
scipy: 0.19.0<br>
xarray: 0.9.2<br>
IPython: 5.3.0<br>
sphinx: None<br>
patsy: 0.4.1<br>
dateutil: 2.6.0<br>
pytz: 2017.2<br>
blosc: None<br>
bottleneck: 1.2.0<br>
tables: None<br>
numexpr: 2.6.2<br>
feather: None<br>
matplotlib: 2.0.1<br>
openpyxl: None<br>
xlrd: None<br>
xlwt: 1.2.0<br>
xlsxwriter: None<br>
lxml: None<br>
bs4: None<br>
html5lib: 0.999999999<br>
sqlalchemy: 1.1.9<br>
pymysql: None<br>
psycopg2: None<br>
jinja2: 2.9.6<br>
s3fs: None<br>
pandas_gbq: 0.1.6<br>
pandas_datareader: None</p>
</details>
<p dir="auto">I've run into a data-dependent bug with MultiIndex. Attached are a test script and a data file generation script:</p>
<ul dir="auto">
<li>sales-data.py loads CSV data from a CSV data file with read_csv and then displays a multiindexed subset.</li>
<li>sales-gen.sh is an AWK script that generates CSV test files. By default, it creates a 600MB file, which causes the failure. To make a smaller test file, which succeeds, just use "head -1000".</li>
</ul>
<p dir="auto">My problem is that sales-data.py breaks with large CSV files but works with smaller CSV files. When it fails it displays the following error message:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="'MultiIndex lexsort depth 0, key was length 4'"><pre class="notranslate"><code class="notranslate">'MultiIndex lexsort depth 0, key was length 4'
</code></pre></div>
<p dir="auto">I know that MultiIndexes must be pre-sorted. So sales-gen.sh makes sure that the first four columns in the auto-generated CSV files are ordered. BTW, I'm not sure why lexsort is getting called.</p>
<h1 dir="auto">sales-data.py</h1>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="#!/usr/bin/env python

import numpy as np
import pandas as pd
from memory_profiler import profile

pd.set_option('display.height',            400)
pd.set_option('display.width',             400)
pd.set_option('display.max_rows',         1000)
pd.set_option('display.max_columns',        30)
pd.set_option('display.line_width',        200)

# @profile
def load_data():
    try:
        df = pd.read_csv(
            './sales-large.csv',
          # './sales-small.csv',
            header = None,
            na_values = ['NULL'],
            names = [
                'salesperson',
                'customer',
                'invoice_date',
                'ship_date',
                'product',
                'quantity',
                'price',
            ],
            index_col = [
                'salesperson',
                'customer',
                'invoice_date',
                'ship_date',
            ],
            parse_dates = [
                'invoice_date',
                'ship_date',
            ],
        )

        print(df.loc[(
            'A00000',                        # salesperson
            'A',                             # customer
            pd.datetime(2011,3,1,0,0,0),     # invoice_date
            pd.datetime(2011,3,6,0,0,0),     # ship_date
        )])

    except Exception as e:
        print(e)

if __name__== '__main__':
    load_data()"><pre class="notranslate"><code class="notranslate">#!/usr/bin/env python

import numpy as np
import pandas as pd
from memory_profiler import profile

pd.set_option('display.height',            400)
pd.set_option('display.width',             400)
pd.set_option('display.max_rows',         1000)
pd.set_option('display.max_columns',        30)
pd.set_option('display.line_width',        200)

# @profile
def load_data():
    try:
        df = pd.read_csv(
            './sales-large.csv',
          # './sales-small.csv',
            header = None,
            na_values = ['NULL'],
            names = [
                'salesperson',
                'customer',
                'invoice_date',
                'ship_date',
                'product',
                'quantity',
                'price',
            ],
            index_col = [
                'salesperson',
                'customer',
                'invoice_date',
                'ship_date',
            ],
            parse_dates = [
                'invoice_date',
                'ship_date',
            ],
        )

        print(df.loc[(
            'A00000',                        # salesperson
            'A',                             # customer
            pd.datetime(2011,3,1,0,0,0),     # invoice_date
            pd.datetime(2011,3,6,0,0,0),     # ship_date
        )])

    except Exception as e:
        print(e)

if __name__== '__main__':
    load_data()
</code></pre></div>
<h1 dir="auto">sales-gen.sh</h1>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="#!/usr/bin/env bash

# 'salesperson',
# 'customer',
# 'invoice_date',
# 'ship_date',
# 'product',
# 'quantity',
# 'price',

awk &quot;BEGIN {                                                                                              \
          first = 65;                                                                                     \
          last = 91;                                                                                      \
          s_char = first;                                                                                 \
          c_char = first;                                                                                 \
                                                                                                          \
          n_sa = 100;                                                                                     \
          n_cu = 100;                                                                                     \
          n_dt = 10;                                                                                      \
          n_pr = 100;                                                                                     \
                                                                                                          \
          for (i = 0; i &lt; n_sa; i++ s_char++) {                                                           \
              if (s_char == last) {                                                                       \
                  s_char = first;                                                                         \
              }                                                                                           \
              c_char = first;                                                                             \
              for (j = 0; j &lt; n_cu; j++ c_char++) {                                                       \
                  if (c_char == last) {                                                                   \
                      c_char = first;                                                                     \
                  }                                                                                       \
                  for (k = 1; k &lt;= n_dt; k++) {                                                           \
                      for (l = 0; l &lt; n_pr; l++) {                                                        \
                          printf(\&quot;%c%05d,%c,2011-03-%02d 00:00:00,2011-03-%02d 00:00:00,%d,%d,%f\n\&quot;,    \
                              s_char, i, c_char, k, k+5, l, 1 + int(rand() * 10), rand())                 \
                      }                                                                                   \
                  }                                                                                       \
              }                                                                                           \
          }                                                                                               \
      }&quot;"><pre class="notranslate"><code class="notranslate">#!/usr/bin/env bash

# 'salesperson',
# 'customer',
# 'invoice_date',
# 'ship_date',
# 'product',
# 'quantity',
# 'price',

awk "BEGIN {                                                                                              \
          first = 65;                                                                                     \
          last = 91;                                                                                      \
          s_char = first;                                                                                 \
          c_char = first;                                                                                 \
                                                                                                          \
          n_sa = 100;                                                                                     \
          n_cu = 100;                                                                                     \
          n_dt = 10;                                                                                      \
          n_pr = 100;                                                                                     \
                                                                                                          \
          for (i = 0; i &lt; n_sa; i++ s_char++) {                                                           \
              if (s_char == last) {                                                                       \
                  s_char = first;                                                                         \
              }                                                                                           \
              c_char = first;                                                                             \
              for (j = 0; j &lt; n_cu; j++ c_char++) {                                                       \
                  if (c_char == last) {                                                                   \
                      c_char = first;                                                                     \
                  }                                                                                       \
                  for (k = 1; k &lt;= n_dt; k++) {                                                           \
                      for (l = 0; l &lt; n_pr; l++) {                                                        \
                          printf(\"%c%05d,%c,2011-03-%02d 00:00:00,2011-03-%02d 00:00:00,%d,%d,%f\n\",    \
                              s_char, i, c_char, k, k+5, l, 1 + int(rand() * 10), rand())                 \
                      }                                                                                   \
                  }                                                                                       \
              }                                                                                           \
          }                                                                                               \
      }"
</code></pre></div>