<h4 dir="auto">Code Sample, a copy-pastable example if possible</h4>
<p dir="auto">On master:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="In [3]: values = ['a', 'b', np.nan]

In [4]: lib.infer_dtype(np.array(values))
Out[4]: 'string'"><pre class="notranslate"><span class="pl-v">In</span> [<span class="pl-c1">3</span>]: <span class="pl-s1">values</span> <span class="pl-c1">=</span> [<span class="pl-s">'a'</span>, <span class="pl-s">'b'</span>, <span class="pl-s1">np</span>.<span class="pl-s1">nan</span>]

<span class="pl-v">In</span> [<span class="pl-c1">4</span>]: <span class="pl-s1">lib</span>.<span class="pl-en">infer_dtype</span>(<span class="pl-s1">np</span>.<span class="pl-en">array</span>(<span class="pl-s1">values</span>))
<span class="pl-v">Out</span>[<span class="pl-c1">4</span>]: <span class="pl-s">'string'</span></pre></div>
<p dir="auto">This returns 'mixed' if the list itself or a Series is passed:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="In [5]: lib.infer_dtype(values)
Out[5]: 'mixed'

In [6]: lib.infer_dtype(pd.Series(values))
Out[6]: 'mixed'"><pre class="notranslate"><span class="pl-v">In</span> [<span class="pl-c1">5</span>]: <span class="pl-s1">lib</span>.<span class="pl-en">infer_dtype</span>(<span class="pl-s1">values</span>)
<span class="pl-v">Out</span>[<span class="pl-c1">5</span>]: <span class="pl-s">'mixed'</span>

<span class="pl-v">In</span> [<span class="pl-c1">6</span>]: <span class="pl-s1">lib</span>.<span class="pl-en">infer_dtype</span>(<span class="pl-s1">pd</span>.<span class="pl-v">Series</span>(<span class="pl-s1">values</span>))
<span class="pl-v">Out</span>[<span class="pl-c1">6</span>]: <span class="pl-s">'mixed'</span></pre></div>
<p dir="auto">This is a problem because it impacts any function that uses hash tables, as it causes NaN to be returned as a string (notice the quotes around <code class="notranslate">'nan'</code> below):</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="In [7]: pd.unique(np.array(values))
Out[7]: array(['a', 'b', 'nan'], dtype=object)"><pre class="notranslate"><span class="pl-v">In</span> [<span class="pl-c1">7</span>]: <span class="pl-s1">pd</span>.<span class="pl-en">unique</span>(<span class="pl-s1">np</span>.<span class="pl-en">array</span>(<span class="pl-s1">values</span>))
<span class="pl-v">Out</span>[<span class="pl-c1">7</span>]: <span class="pl-en">array</span>([<span class="pl-s">'a'</span>, <span class="pl-s">'b'</span>, <span class="pl-s">'nan'</span>], <span class="pl-s1">dtype</span><span class="pl-c1">=</span><span class="pl-s1">object</span>)</pre></div>
<p dir="auto">Again, this doesn't happen if the list itself or a Series is passed:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="In [8]: pd.unique(values)
Out[8]: array(['a', 'b', nan], dtype=object)

In [9]: pd.unique(pd.Series(values))
Out[9]: array(['a', 'b', nan], dtype=object)"><pre class="notranslate"><span class="pl-v">In</span> [<span class="pl-c1">8</span>]: <span class="pl-s1">pd</span>.<span class="pl-en">unique</span>(<span class="pl-s1">values</span>)
<span class="pl-v">Out</span>[<span class="pl-c1">8</span>]: <span class="pl-en">array</span>([<span class="pl-s">'a'</span>, <span class="pl-s">'b'</span>, <span class="pl-s1">nan</span>], <span class="pl-s1">dtype</span><span class="pl-c1">=</span><span class="pl-s1">object</span>)

<span class="pl-v">In</span> [<span class="pl-c1">9</span>]: <span class="pl-s1">pd</span>.<span class="pl-en">unique</span>(<span class="pl-s1">pd</span>.<span class="pl-v">Series</span>(<span class="pl-s1">values</span>))
<span class="pl-v">Out</span>[<span class="pl-c1">9</span>]: <span class="pl-en">array</span>([<span class="pl-s">'a'</span>, <span class="pl-s">'b'</span>, <span class="pl-s1">nan</span>], <span class="pl-s1">dtype</span><span class="pl-c1">=</span><span class="pl-s1">object</span>)</pre></div>
<p dir="auto">Which appears to be caused by <code class="notranslate">infer_dtype</code> returning 'string' instead of 'mixed' here:<br>
</p><div class="Box Box--condensed my-2">
  <div class="Box-header f6">
    <p class="mb-0 text-bold">
      <a href="https://github.com/pandas-dev/pandas/blob/488db6f9a0f19e1d18559e6c2056e9545fe14704/pandas/core/algorithms.py#L207-L211">pandas/pandas/core/algorithms.py</a>
    </p>
    <p class="mb-0 color-fg-muted">
        Lines 207 to 211
      in
      <a data-pjax="true" class="commit-tease-sha" href="/pandas-dev/pandas/commit/488db6f9a0f19e1d18559e6c2056e9545fe14704">488db6f</a>
    </p>
  </div>
  <div itemprop="text" class="Box-body p-0 blob-wrapper blob-wrapper-embedded data">
    <table class="highlight tab-size mb-0 js-file-line-container" data-tab-size="8" data-paste-markdown-skip="">

        <tbody><tr class="border-0">
          <td id="L207" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="207"></td>
          <td id="LC207" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> <span class="pl-c"># its cheaper to use a String Hash Table than Object</span> </td>
        </tr>

        <tr class="border-0">
          <td id="L208" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="208"></td>
          <td id="LC208" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> <span class="pl-k">if</span> <span class="pl-s1">lib</span>.<span class="pl-en">infer_dtype</span>(<span class="pl-s1">values</span>) <span class="pl-c1">in</span> [<span class="pl-s">'string'</span>]: </td>
        </tr>

        <tr class="border-0">
          <td id="L209" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="209"></td>
          <td id="LC209" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line">     <span class="pl-s1">ndtype</span> <span class="pl-c1">=</span> <span class="pl-s">'string'</span> </td>
        </tr>

        <tr class="border-0">
          <td id="L210" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="210"></td>
          <td id="LC210" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> <span class="pl-k">else</span>: </td>
        </tr>

        <tr class="border-0">
          <td id="L211" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="211"></td>
          <td id="LC211" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line">     <span class="pl-s1">ndtype</span> <span class="pl-c1">=</span> <span class="pl-s">'object'</span> </td>
        </tr>
    </tbody></table>
  </div>
</div>
<p></p>
<h4 dir="auto">Problem description</h4>
<p dir="auto"><code class="notranslate">infer_dtype</code> incorrectly returns 'string', causing NaN to get converted to a string by functions that use hash tables.</p>
<h4 dir="auto">Expected Output</h4>
<p dir="auto"><code class="notranslate">infer_dtype</code> to return 'mixed'.</p>
<h4 dir="auto">Output of <code class="notranslate">pd.show_versions()</code></h4>
<details>
<h2 dir="auto">INSTALLED VERSIONS</h2>
<p dir="auto">commit: <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/pandas-dev/pandas/commit/488db6f9a0f19e1d18559e6c2056e9545fe14704/hovercard" href="https://github.com/pandas-dev/pandas/commit/488db6f9a0f19e1d18559e6c2056e9545fe14704"><tt>488db6f</tt></a><br>
python: 3.6.1.final.0<br>
python-bits: 64<br>
OS: Windows<br>
OS-release: 10<br>
machine: AMD64<br>
processor: Intel64 Family 6 Model 78 Stepping 3, GenuineIntel<br>
byteorder: little<br>
LC_ALL: None<br>
LANG: None<br>
LOCALE: None.None</p>
<p dir="auto">pandas: 0.22.0.dev0+74.g488db6f<br>
pytest: 3.1.2<br>
pip: 9.0.1<br>
setuptools: 27.2.0<br>
Cython: 0.25.2<br>
numpy: 1.13.1<br>
scipy: 0.19.1<br>
pyarrow: 0.6.0<br>
xarray: 0.9.6<br>
IPython: 6.1.0<br>
sphinx: 1.5.6<br>
patsy: 0.4.1<br>
dateutil: 2.6.0<br>
pytz: 2017.2<br>
blosc: None<br>
bottleneck: None<br>
tables: 3.4.2<br>
numexpr: 2.6.2<br>
feather: 0.4.0<br>
matplotlib: 2.0.2<br>
openpyxl: 2.4.8<br>
xlrd: 1.1.0<br>
xlwt: 1.3.0<br>
xlsxwriter: 0.9.8<br>
lxml: 3.8.0<br>
bs4: None<br>
html5lib: 0.999<br>
sqlalchemy: 1.1.13<br>
pymysql: None<br>
psycopg2: None<br>
jinja2: 2.9.6<br>
s3fs: None<br>
fastparquet: 0.1.0<br>
pandas_gbq: None<br>
pandas_datareader: None</p>
</details>
<p dir="auto">It is not clear if this should raise on construction or not<br>
<a href="http://stackoverflow.com/questions/17338148/pandas-duplicate-datetimeindex-entries-lead-to-odd-exception?noredirect=1#comment25166923_17338148" rel="nofollow">http://stackoverflow.com/questions/17338148/pandas-duplicate-datetimeindex-entries-lead-to-odd-exception?noredirect=1#comment25166923_17338148</a></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="In [3]: from collections import OrderedDict

In [4]: import datetime as dt

In [5]: a = [1371215933513120, 1371215933513121, 1371215933513122, 1371215933513122]

In [6]: b = [1,2,3,4]

In [7]: df = pd.DataFrame({'a':a, 'b':b, 'c':[dt.datetime.fromtimestamp(t/1000000.) for t in a]})

In [8]: df.index=pd.DatetimeIndex(df['c'])

In [9]: d = OrderedDict()

In [10]: d['x'] = df

In [11]: p = pd.Panel(d)

In [12]: for y in p.major_axis:
   ....:         print y
   ....:         print p.major_xs(y)
   ....:     
2013-06-14 09:18:53.513120
                            x
a            1371215933513120
b                           1
c  2013-06-14 09:18:53.513120
2013-06-14 09:18:53.513121
                            x
a            1371215933513121
b                           2
c  2013-06-14 09:18:53.513121
2013-06-14 09:18:53.513122
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()"><pre class="notranslate"><code class="notranslate">In [3]: from collections import OrderedDict

In [4]: import datetime as dt

In [5]: a = [1371215933513120, 1371215933513121, 1371215933513122, 1371215933513122]

In [6]: b = [1,2,3,4]

In [7]: df = pd.DataFrame({'a':a, 'b':b, 'c':[dt.datetime.fromtimestamp(t/1000000.) for t in a]})

In [8]: df.index=pd.DatetimeIndex(df['c'])

In [9]: d = OrderedDict()

In [10]: d['x'] = df

In [11]: p = pd.Panel(d)

In [12]: for y in p.major_axis:
   ....:         print y
   ....:         print p.major_xs(y)
   ....:     
2013-06-14 09:18:53.513120
                            x
a            1371215933513120
b                           1
c  2013-06-14 09:18:53.513120
2013-06-14 09:18:53.513121
                            x
a            1371215933513121
b                           2
c  2013-06-14 09:18:53.513121
2013-06-14 09:18:53.513122
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
</code></pre></div>