<p dir="auto">I would expect this syntax to work without problems</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import pandas as pd
d = [{'a':'1','b':'2'},{'a':'3','b':'4'}]
pd.DataFrame.from_dict(d, orient='columns', dtype={'a':int,'b':int})"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-s1">pandas</span> <span class="pl-k">as</span> <span class="pl-s1">pd</span>
<span class="pl-s1">d</span> <span class="pl-c1">=</span> [{<span class="pl-s">'a'</span>:<span class="pl-s">'1'</span>,<span class="pl-s">'b'</span>:<span class="pl-s">'2'</span>},{<span class="pl-s">'a'</span>:<span class="pl-s">'3'</span>,<span class="pl-s">'b'</span>:<span class="pl-s">'4'</span>}]
<span class="pl-s1">pd</span>.<span class="pl-v">DataFrame</span>.<span class="pl-en">from_dict</span>(<span class="pl-s1">d</span>, <span class="pl-s1">orient</span><span class="pl-c1">=</span><span class="pl-s">'columns'</span>, <span class="pl-s1">dtype</span><span class="pl-c1">=</span>{<span class="pl-s">'a'</span>:<span class="pl-s1">int</span>,<span class="pl-s">'b'</span>:<span class="pl-s1">int</span>})</pre></div>
<h4 dir="auto">Expected Output</h4>
<p dir="auto">Expected DataFrame:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="       a  b
    0  1  2
    1  3  4"><pre class="notranslate"><code class="notranslate">       a  b
    0  1  2
    1  3  4
</code></pre></div>
<p dir="auto">with dtypes:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="    a    int64
    b    int64
    dtype: object"><pre class="notranslate"><code class="notranslate">    a    int64
    b    int64
    dtype: object
</code></pre></div>
<p dir="auto">Instead, the output is</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="/usr/lib/python2.7/dist-packages/numpy/core/_internal.pyc in _makenames_list(adict, align)
     24     for fname in fnames:
     25         obj = adict[fname]
---&gt; 26         n = len(obj)
     27         if not isinstance(obj, tuple) or n not in [2, 3]:
     28             raise ValueError(&quot;entry not a 2- or 3- tuple&quot;)

TypeError: object of type 'type' has no len()"><pre class="notranslate"><code class="notranslate">/usr/lib/python2.7/dist-packages/numpy/core/_internal.pyc in _makenames_list(adict, align)
     24     for fname in fnames:
     25         obj = adict[fname]
---&gt; 26         n = len(obj)
     27         if not isinstance(obj, tuple) or n not in [2, 3]:
     28             raise ValueError("entry not a 2- or 3- tuple")

TypeError: object of type 'type' has no len()
</code></pre></div>
<h4 dir="auto">Output of <code class="notranslate">pd.show_versions()</code></h4>
<details>
# Paste the output here pd.show_versions() here
INSTALLED VERSIONS
------------------
commit: None
python: 2.7.9.final.0
python-bits: 64
OS: Linux
OS-release: 3.19.0-68-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_GB.UTF-8
<p dir="auto">pandas: 0.18.1<br>
nose: 1.3.4<br>
pip: None<br>
setuptools: 26.1.1<br>
Cython: 0.24.1<br>
numpy: 1.8.2<br>
scipy: 0.14.1<br>
statsmodels: None<br>
xarray: None<br>
IPython: 5.1.0<br>
sphinx: None<br>
patsy: None<br>
dateutil: 2.2<br>
pytz: 2015.7<br>
blosc: None<br>
bottleneck: None<br>
tables: None<br>
numexpr: None<br>
matplotlib: 1.4.2<br>
openpyxl: 2.3.5<br>
xlrd: 1.0.0<br>
xlwt: None<br>
xlsxwriter: None<br>
lxml: 3.4.2<br>
bs4: 4.3.2<br>
html5lib: 0.999<br>
httplib2: 0.9.2<br>
apiclient: 1.5.3<br>
sqlalchemy: 0.9.8<br>
pymysql: None<br>
psycopg2: None<br>
jinja2: 2.8<br>
boto: 2.34.0<br>
pandas_datareader: None</p>
</details>
<p dir="auto">Similar to <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="18969186" data-permission-text="Title is private" data-url="https://github.com/pandas-dev/pandas/issues/4746" data-hovercard-type="issue" data-hovercard-url="/pandas-dev/pandas/issues/4746/hovercard" href="https://github.com/pandas-dev/pandas/issues/4746">#4746</a>, trying to <code class="notranslate">resample</code> with an index containing <code class="notranslate">NaT</code> produces rather ambiguous error messages of the form:</p>
<blockquote>
<p dir="auto">ValueError: Shape of passed values is (2, 5), indices imply (2, 4)</p>
</blockquote>
<p dir="auto">Something like <code class="notranslate">cannot resample from index containing Not-a-Time (NaT)</code> would be more helpful to users.</p>
<h4 dir="auto">MWE</h4>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import pandas as pd
import numpy as np

times = pd.DatetimeIndex(['20160428T110000',
                          '20160428T110001',
                          '20160428T110002',
                          '20160428T110003',
                          '20160428T110004',
                          pd.NaT,
                          '20160428T110001',
                          '20160428T110002',
                          '20160428T110003',
                          '20160428T110004'])

df = pd.DataFrame(np.random.randn(10,2),
                  index=times,
                  columns=['A', 'B'])
df.resample('3s')"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-s1">pandas</span> <span class="pl-k">as</span> <span class="pl-s1">pd</span>
<span class="pl-k">import</span> <span class="pl-s1">numpy</span> <span class="pl-k">as</span> <span class="pl-s1">np</span>

<span class="pl-s1">times</span> <span class="pl-c1">=</span> <span class="pl-s1">pd</span>.<span class="pl-v">DatetimeIndex</span>([<span class="pl-s">'20160428T110000'</span>,
                          <span class="pl-s">'20160428T110001'</span>,
                          <span class="pl-s">'20160428T110002'</span>,
                          <span class="pl-s">'20160428T110003'</span>,
                          <span class="pl-s">'20160428T110004'</span>,
                          <span class="pl-s1">pd</span>.<span class="pl-v">NaT</span>,
                          <span class="pl-s">'20160428T110001'</span>,
                          <span class="pl-s">'20160428T110002'</span>,
                          <span class="pl-s">'20160428T110003'</span>,
                          <span class="pl-s">'20160428T110004'</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-s1">np</span>.<span class="pl-s1">random</span>.<span class="pl-en">randn</span>(<span class="pl-c1">10</span>,<span class="pl-c1">2</span>),
                  <span class="pl-s1">index</span><span class="pl-c1">=</span><span class="pl-s1">times</span>,
                  <span class="pl-s1">columns</span><span class="pl-c1">=</span>[<span class="pl-s">'A'</span>, <span class="pl-s">'B'</span>])
<span class="pl-s1">df</span>.<span class="pl-en">resample</span>(<span class="pl-s">'3s'</span>)</pre></div>
<p dir="auto"><em>This example index contains duplicate values, but results are the same w/ or w/o them.</em></p>
<h4 dir="auto">output of <code class="notranslate">pd.show_versions()</code></h4>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="INSTALLED VERSIONS
------------------
commit: None
python: 2.7.9.final.0
python-bits: 32
OS: Windows
OS-release: 7
machine: AMD64
processor: Intel64 Family 6 Model 23 Stepping 10, GenuineIntel
byteorder: little
LC_ALL: None
LANG: None

pandas: 0.15.2
nose: 1.3.4
Cython: 0.21.1
numpy: 1.8.2
scipy: 0.14.0
statsmodels: 0.6.1
IPython: 2.3.1
sphinx: 1.2.3
patsy: 0.3.0
dateutil: 2.3
pytz: 2014.10
bottleneck: None
tables: 3.1.1
numexpr: 2.4
matplotlib: 1.4.2
openpyxl: None
xlrd: 0.9.3
xlwt: None
xlsxwriter: 0.6.4
lxml: 3.4.1
bs4: 4.3.2
html5lib: None
httplib2: None
apiclient: None
rpy2: 2.5.2
sqlalchemy: 0.9.8
pymysql: None
psycopg2: None"><pre class="notranslate"><code class="notranslate">INSTALLED VERSIONS
------------------
commit: None
python: 2.7.9.final.0
python-bits: 32
OS: Windows
OS-release: 7
machine: AMD64
processor: Intel64 Family 6 Model 23 Stepping 10, GenuineIntel
byteorder: little
LC_ALL: None
LANG: None

pandas: 0.15.2
nose: 1.3.4
Cython: 0.21.1
numpy: 1.8.2
scipy: 0.14.0
statsmodels: 0.6.1
IPython: 2.3.1
sphinx: 1.2.3
patsy: 0.3.0
dateutil: 2.3
pytz: 2014.10
bottleneck: None
tables: 3.1.1
numexpr: 2.4
matplotlib: 1.4.2
openpyxl: None
xlrd: 0.9.3
xlwt: None
xlsxwriter: 0.6.4
lxml: 3.4.1
bs4: 4.3.2
html5lib: None
httplib2: None
apiclient: None
rpy2: 2.5.2
sqlalchemy: 0.9.8
pymysql: None
psycopg2: None
</code></pre></div>