<h4 dir="auto">Code</h4>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="In [33]: df = pd.DataFrame({'date1': [Timestamp('2017-05-25 14:02:23'), NaT],
             'date2': [Timestamp('2017-05-25 14:34:43'), Timestamp('2017-05-16 19:37:43')]})

In [34]: df2 = df.apply(lambda x: x.dt.tz_localize('UTC'), axis=0)

In [35]: df3 = df2.assign(date1=df2.date2)

In [36]: df
Out[36]:
                date1               date2
0 2017-05-25 14:02:23 2017-05-25 14:34:43
1                 NaT 2017-05-16 19:37:43

In [37]: df2
Out[37]:
                      date1                     date2
0 2017-05-25 14:02:23+00:00 2017-05-25 14:34:43+00:00
1                       NaT 2017-05-16 19:37:43+00:00

In [38]: df3
Out[38]:
                      date1                     date2
0 2017-05-25 14:34:43+00:00 2017-05-25 14:34:43+00:00
1 2017-05-16 19:37:43+00:00 2017-05-16 19:37:43+00:00

In [39]: df.dtypes
Out[39]:
date1    datetime64[ns]
date2    datetime64[ns]
dtype: object

In [40]: df2.dtypes
Out[40]:
date1    datetime64[ns, UTC]
date2    datetime64[ns, UTC]
dtype: object

In [41]: df3.dtypes
Out[41]:
date1    datetime64[ns, UTC]
date2    datetime64[ns, UTC]
dtype: object

In [42]: df.T
Out[42]:
                        0                   1
date1 2017-05-25 14:02:23                 NaT
date2 2017-05-25 14:34:43 2017-05-16 19:37:43

In [43]: df2.T
---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
&lt;ipython-input-43-7d2317a1beae&gt; in &lt;module&gt;()
----&gt; 1 df2.T

e:\github\pandas\pandas\core\frame.pyc in transpose(self, *args, **kwargs)
   1876         &quot;&quot;&quot;Transpose index and columns&quot;&quot;&quot;
   1877         nv.validate_transpose(args, dict())
-&gt; 1878         return super(DataFrame, self).transpose(1, 0, **kwargs)
   1879
   1880     T = property(transpose)

e:\github\pandas\pandas\core\generic.pyc in transpose(self, *args, **kwargs)
    600
    601         nv.validate_transpose_for_generic(self, kwargs)
--&gt; 602         return self._constructor(new_values, **new_axes).__finalize__(self)
    603
    604     def swapaxes(self, axis1, axis2, copy=True):

e:\github\pandas\pandas\core\frame.pyc in __init__(self, data, index, columns, dtype, copy)
    350             else:
    351                 mgr = self._init_ndarray(data, index, columns, dtype=dtype,
--&gt; 352                                          copy=copy)
    353         elif isinstance(data, (list, types.GeneratorType)):
    354             if isinstance(data, types.GeneratorType):

e:\github\pandas\pandas\core\frame.pyc in _init_ndarray(self, values, index, columns, dtype, copy)
    522             values = maybe_infer_to_datetimelike(values)
    523
--&gt; 524         return create_block_manager_from_blocks([values], [columns, index])
    525
    526     @property

e:\github\pandas\pandas\core\internals.pyc in create_block_manager_from_blocks(blocks, axes)
   4378                                      placement=slice(0, len(axes[0])))]
   4379
-&gt; 4380         mgr = BlockManager(blocks, axes)
   4381         mgr._consolidate_inplace()
   4382         return mgr

e:\github\pandas\pandas\core\internals.pyc in __init__(self, blocks, axes, do_integrity_check, fastpath)
   2880                     raise AssertionError('Number of Block dimensions (%d) '
   2881                                          'must equal number of axes (%d)' %
-&gt; 2882                                          (block.ndim, self.ndim))
   2883
   2884         if do_integrity_check:

AssertionError: Number of Block dimensions (1) must equal number of axes (2)"><pre class="notranslate"><span class="pl-v">In</span> [<span class="pl-c1">33</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">'date1'</span>: [<span class="pl-v">Timestamp</span>(<span class="pl-s">'2017-05-25 14:02:23'</span>), <span class="pl-v">NaT</span>],
             <span class="pl-s">'date2'</span>: [<span class="pl-v">Timestamp</span>(<span class="pl-s">'2017-05-25 14:34:43'</span>), <span class="pl-v">Timestamp</span>(<span class="pl-s">'2017-05-16 19:37:43'</span>)]})

<span class="pl-v">In</span> [<span class="pl-c1">34</span>]: <span class="pl-s1">df2</span> <span class="pl-c1">=</span> <span class="pl-s1">df</span>.<span class="pl-en">apply</span>(<span class="pl-k">lambda</span> <span class="pl-s1">x</span>: <span class="pl-s1">x</span>.<span class="pl-s1">dt</span>.<span class="pl-en">tz_localize</span>(<span class="pl-s">'UTC'</span>), <span class="pl-s1">axis</span><span class="pl-c1">=</span><span class="pl-c1">0</span>)

<span class="pl-v">In</span> [<span class="pl-c1">35</span>]: <span class="pl-s1">df3</span> <span class="pl-c1">=</span> <span class="pl-s1">df2</span>.<span class="pl-en">assign</span>(<span class="pl-s1">date1</span><span class="pl-c1">=</span><span class="pl-s1">df2</span>.<span class="pl-s1">date2</span>)

<span class="pl-v">In</span> [<span class="pl-c1">36</span>]: <span class="pl-s1">df</span>
<span class="pl-v">Out</span>[<span class="pl-c1">36</span>]:
                <span class="pl-s1">date1</span>               <span class="pl-s1">date2</span>
<span class="pl-c1">0</span> <span class="pl-c1">2017</span><span class="pl-c1">-</span><span class="pl-c1">05</span><span class="pl-c1">-</span><span class="pl-c1">25</span> <span class="pl-c1">14</span>:<span class="pl-c1">02</span>:<span class="pl-c1">23</span> <span class="pl-c1">2017</span><span class="pl-c1">-</span><span class="pl-c1">05</span><span class="pl-c1">-</span><span class="pl-c1">25</span> <span class="pl-c1">14</span>:<span class="pl-c1">34</span>:<span class="pl-c1">43</span>
<span class="pl-c1">1</span>                 <span class="pl-v">NaT</span> <span class="pl-c1">2017</span><span class="pl-c1">-</span><span class="pl-c1">05</span><span class="pl-c1">-</span><span class="pl-c1">16</span> <span class="pl-c1">19</span>:<span class="pl-c1">37</span>:<span class="pl-c1">43</span>

<span class="pl-v">In</span> [<span class="pl-c1">37</span>]: <span class="pl-s1">df2</span>
<span class="pl-v">Out</span>[<span class="pl-c1">37</span>]:
                      <span class="pl-s1">date1</span>                     <span class="pl-s1">date2</span>
<span class="pl-c1">0</span> <span class="pl-c1">2017</span><span class="pl-c1">-</span><span class="pl-c1">05</span><span class="pl-c1">-</span><span class="pl-c1">25</span> <span class="pl-c1">14</span>:<span class="pl-c1">02</span>:<span class="pl-c1">23</span><span class="pl-c1">+</span><span class="pl-c1">00</span>:<span class="pl-c1">00</span> <span class="pl-c1">2017</span><span class="pl-c1">-</span><span class="pl-c1">05</span><span class="pl-c1">-</span><span class="pl-c1">25</span> <span class="pl-c1">14</span>:<span class="pl-c1">34</span>:<span class="pl-c1">43</span><span class="pl-c1">+</span><span class="pl-c1">00</span>:<span class="pl-c1">00</span>
<span class="pl-c1">1</span>                       <span class="pl-v">NaT</span> <span class="pl-c1">2017</span><span class="pl-c1">-</span><span class="pl-c1">05</span><span class="pl-c1">-</span><span class="pl-c1">16</span> <span class="pl-c1">19</span>:<span class="pl-c1">37</span>:<span class="pl-c1">43</span><span class="pl-c1">+</span><span class="pl-c1">00</span>:<span class="pl-c1">00</span>

<span class="pl-v">In</span> [<span class="pl-c1">38</span>]: <span class="pl-s1">df3</span>
<span class="pl-v">Out</span>[<span class="pl-c1">38</span>]:
                      <span class="pl-s1">date1</span>                     <span class="pl-s1">date2</span>
<span class="pl-c1">0</span> <span class="pl-c1">2017</span><span class="pl-c1">-</span><span class="pl-c1">05</span><span class="pl-c1">-</span><span class="pl-c1">25</span> <span class="pl-c1">14</span>:<span class="pl-c1">34</span>:<span class="pl-c1">43</span><span class="pl-c1">+</span><span class="pl-c1">00</span>:<span class="pl-c1">00</span> <span class="pl-c1">2017</span><span class="pl-c1">-</span><span class="pl-c1">05</span><span class="pl-c1">-</span><span class="pl-c1">25</span> <span class="pl-c1">14</span>:<span class="pl-c1">34</span>:<span class="pl-c1">43</span><span class="pl-c1">+</span><span class="pl-c1">00</span>:<span class="pl-c1">00</span>
<span class="pl-c1">1</span> <span class="pl-c1">2017</span><span class="pl-c1">-</span><span class="pl-c1">05</span><span class="pl-c1">-</span><span class="pl-c1">16</span> <span class="pl-c1">19</span>:<span class="pl-c1">37</span>:<span class="pl-c1">43</span><span class="pl-c1">+</span><span class="pl-c1">00</span>:<span class="pl-c1">00</span> <span class="pl-c1">2017</span><span class="pl-c1">-</span><span class="pl-c1">05</span><span class="pl-c1">-</span><span class="pl-c1">16</span> <span class="pl-c1">19</span>:<span class="pl-c1">37</span>:<span class="pl-c1">43</span><span class="pl-c1">+</span><span class="pl-c1">00</span>:<span class="pl-c1">00</span>

<span class="pl-v">In</span> [<span class="pl-c1">39</span>]: <span class="pl-s1">df</span>.<span class="pl-s1">dtypes</span>
<span class="pl-v">Out</span>[<span class="pl-c1">39</span>]:
<span class="pl-s1">date1</span>    <span class="pl-s1">datetime64</span>[<span class="pl-s1">ns</span>]
<span class="pl-s1">date2</span>    <span class="pl-s1">datetime64</span>[<span class="pl-s1">ns</span>]
<span class="pl-s1">dtype</span>: <span class="pl-s1">object</span>

<span class="pl-v">In</span> [<span class="pl-c1">40</span>]: <span class="pl-s1">df2</span>.<span class="pl-s1">dtypes</span>
<span class="pl-v">Out</span>[<span class="pl-c1">40</span>]:
<span class="pl-s1">date1</span>    <span class="pl-s1">datetime64</span>[<span class="pl-s1">ns</span>, <span class="pl-v">UTC</span>]
<span class="pl-s1">date2</span>    <span class="pl-s1">datetime64</span>[<span class="pl-s1">ns</span>, <span class="pl-v">UTC</span>]
<span class="pl-s1">dtype</span>: <span class="pl-s1">object</span>

<span class="pl-v">In</span> [<span class="pl-c1">41</span>]: <span class="pl-s1">df3</span>.<span class="pl-s1">dtypes</span>
<span class="pl-v">Out</span>[<span class="pl-c1">41</span>]:
<span class="pl-s1">date1</span>    <span class="pl-s1">datetime64</span>[<span class="pl-s1">ns</span>, <span class="pl-v">UTC</span>]
<span class="pl-s1">date2</span>    <span class="pl-s1">datetime64</span>[<span class="pl-s1">ns</span>, <span class="pl-v">UTC</span>]
<span class="pl-s1">dtype</span>: <span class="pl-s1">object</span>

<span class="pl-v">In</span> [<span class="pl-c1">42</span>]: <span class="pl-s1">df</span>.<span class="pl-v">T</span>
<span class="pl-v">Out</span>[<span class="pl-c1">42</span>]:
                        <span class="pl-c1">0</span>                   <span class="pl-c1">1</span>
<span class="pl-s1">date1</span> <span class="pl-c1">2017</span><span class="pl-c1">-</span><span class="pl-c1">05</span><span class="pl-c1">-</span><span class="pl-c1">25</span> <span class="pl-c1">14</span>:<span class="pl-c1">02</span>:<span class="pl-c1">23</span>                 <span class="pl-v">NaT</span>
<span class="pl-s1">date2</span> <span class="pl-c1">2017</span><span class="pl-c1">-</span><span class="pl-c1">05</span><span class="pl-c1">-</span><span class="pl-c1">25</span> <span class="pl-c1">14</span>:<span class="pl-c1">34</span>:<span class="pl-c1">43</span> <span class="pl-c1">2017</span><span class="pl-c1">-</span><span class="pl-c1">05</span><span class="pl-c1">-</span><span class="pl-c1">16</span> <span class="pl-c1">19</span>:<span class="pl-c1">37</span>:<span class="pl-c1">43</span>

<span class="pl-v">In</span> [<span class="pl-c1">43</span>]: <span class="pl-s1">df2</span>.<span class="pl-v">T</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">AssertionError</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">43</span><span class="pl-c1">-</span><span class="pl-c1">7</span><span class="pl-s1">d2317a1beae</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">-</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">1</span> <span class="pl-s1">df2</span>.<span class="pl-v">T</span>

<span class="pl-s1">e</span>:\g<span class="pl-s1">ithub</span>\p<span class="pl-s1">andas</span>\p<span class="pl-s1">andas</span>\c<span class="pl-s1">ore</span>\f<span class="pl-s1">rame</span>.<span class="pl-s1">pyc</span> <span class="pl-c1">in</span> <span class="pl-en">transpose</span>(<span class="pl-s1">self</span>, <span class="pl-c1">*</span><span class="pl-s1">args</span>, <span class="pl-c1">**</span><span class="pl-s1">kwargs</span>)
   <span class="pl-c1">1876</span>         <span class="pl-s">"""Transpose index and columns"""</span>
   <span class="pl-c1">1877</span>         <span class="pl-s1">nv</span>.<span class="pl-en">validate_transpose</span>(<span class="pl-s1">args</span>, <span class="pl-en">dict</span>())
<span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-c1">1878</span>         <span class="pl-s1">return</span> <span class="pl-en">super</span>(<span class="pl-v">DataFrame</span>, <span class="pl-s1">self</span>).<span class="pl-en">transpose</span>(<span class="pl-c1">1</span>, <span class="pl-c1">0</span>, <span class="pl-c1">**</span><span class="pl-s1">kwargs</span>)
   <span class="pl-c1">1879</span>
   <span class="pl-c1">1880</span>     <span class="pl-v">T</span> <span class="pl-c1">=</span> <span class="pl-en">property</span>(<span class="pl-s1">transpose</span>)

<span class="pl-s1">e</span>:\g<span class="pl-s1">ithub</span>\p<span class="pl-s1">andas</span>\p<span class="pl-s1">andas</span>\c<span class="pl-s1">ore</span>\g<span class="pl-s1">eneric</span>.<span class="pl-s1">pyc</span> <span class="pl-c1">in</span> <span class="pl-en">transpose</span>(<span class="pl-s1">self</span>, <span class="pl-c1">*</span><span class="pl-s1">args</span>, <span class="pl-c1">**</span><span class="pl-s1">kwargs</span>)
    <span class="pl-c1">600</span>
    <span class="pl-c1">601</span>         <span class="pl-s1">nv</span>.<span class="pl-en">validate_transpose_for_generic</span>(<span class="pl-s1">self</span>, <span class="pl-s1">kwargs</span>)
<span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-c1">602</span>         <span class="pl-s1">return</span> <span class="pl-s1">self</span>.<span class="pl-en">_constructor</span>(<span class="pl-s1">new_values</span>, <span class="pl-c1">**</span><span class="pl-s1">new_axes</span>).<span class="pl-en">__finalize__</span>(<span class="pl-s1">self</span>)
    <span class="pl-c1">603</span>
    <span class="pl-c1">604</span>     <span class="pl-k">def</span> <span class="pl-en">swapaxes</span>(<span class="pl-s1">self</span>, <span class="pl-s1">axis1</span>, <span class="pl-s1">axis2</span>, <span class="pl-s1">copy</span><span class="pl-c1">=</span><span class="pl-c1">True</span>):

<span class="pl-s1">e</span>:\g<span class="pl-s1">ithub</span>\p<span class="pl-s1">andas</span>\p<span class="pl-s1">andas</span>\c<span class="pl-s1">ore</span>\f<span class="pl-s1">rame</span>.<span class="pl-s1">pyc</span> <span class="pl-c1">in</span> <span class="pl-en">__init__</span>(<span class="pl-s1">self</span>, <span class="pl-s1">data</span>, <span class="pl-s1">index</span>, <span class="pl-s1">columns</span>, <span class="pl-s1">dtype</span>, <span class="pl-s1">copy</span>)
    <span class="pl-c1">350</span>             <span class="pl-s1">else</span>:
    <span class="pl-c1">351</span>                 <span class="pl-s1">mgr</span> <span class="pl-c1">=</span> <span class="pl-s1">self</span>.<span class="pl-en">_init_ndarray</span>(<span class="pl-s1">data</span>, <span class="pl-s1">index</span>, <span class="pl-s1">columns</span>, <span class="pl-s1">dtype</span><span class="pl-c1">=</span><span class="pl-s1">dtype</span>,
<span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-c1">352</span>                                          <span class="pl-s1">copy</span><span class="pl-c1">=</span><span class="pl-s1">copy</span>)
    <span class="pl-c1">353</span>         <span class="pl-s1">elif</span> <span class="pl-s1">isinstance</span>(<span class="pl-s1">data</span>, (<span class="pl-s1">list</span>, <span class="pl-s1">types</span>.<span class="pl-v">GeneratorType</span>)):
    <span class="pl-c1">354</span>             <span class="pl-k">if</span> <span class="pl-en">isinstance</span>(<span class="pl-s1">data</span>, <span class="pl-s1">types</span>.<span class="pl-v">GeneratorType</span>):

<span class="pl-s1">e</span>:\g<span class="pl-s1">ithub</span>\p<span class="pl-s1">andas</span>\p<span class="pl-s1">andas</span>\c<span class="pl-s1">ore</span>\f<span class="pl-s1">rame</span>.<span class="pl-s1">pyc</span> <span class="pl-c1">in</span> <span class="pl-en">_init_ndarray</span>(<span class="pl-s1">self</span>, <span class="pl-s1">values</span>, <span class="pl-s1">index</span>, <span class="pl-s1">columns</span>, <span class="pl-s1">dtype</span>, <span class="pl-s1">copy</span>)
    <span class="pl-c1">522</span>             <span class="pl-s1">values</span> <span class="pl-c1">=</span> <span class="pl-en">maybe_infer_to_datetimelike</span>(<span class="pl-s1">values</span>)
    <span class="pl-c1">523</span>
<span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-c1">524</span>         <span class="pl-s1">return</span> <span class="pl-en">create_block_manager_from_blocks</span>([<span class="pl-s1">values</span>], [<span class="pl-s1">columns</span>, <span class="pl-s1">index</span>])
    <span class="pl-c1">525</span>
    <span class="pl-c1">526</span>     @<span class="pl-s1">property</span>

<span class="pl-s1">e</span>:\g<span class="pl-s1">ithub</span>\p<span class="pl-s1">andas</span>\p<span class="pl-s1">andas</span>\c<span class="pl-s1">ore</span>\i<span class="pl-s1">nternals</span>.<span class="pl-s1">pyc</span> <span class="pl-c1">in</span> <span class="pl-en">create_block_manager_from_blocks</span>(<span class="pl-s1">blocks</span>, <span class="pl-s1">axes</span>)
   <span class="pl-c1">4378</span>                                      <span class="pl-s1">placement</span><span class="pl-c1">=</span><span class="pl-en">slice</span>(<span class="pl-c1">0</span>, <span class="pl-en">len</span>(<span class="pl-s1">axes</span>[<span class="pl-c1">0</span>])))]
   <span class="pl-c1">4379</span>
<span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-c1">4380</span>         <span class="pl-s1">mgr</span> <span class="pl-c1">=</span> <span class="pl-v">BlockManager</span>(<span class="pl-s1">blocks</span>, <span class="pl-s1">axes</span>)
   <span class="pl-c1">4381</span>         <span class="pl-s1">mgr</span>.<span class="pl-en">_consolidate_inplace</span>()
   <span class="pl-c1">4382</span>         <span class="pl-k">return</span> <span class="pl-s1">mgr</span>

<span class="pl-s1">e</span>:\g<span class="pl-s1">ithub</span>\p<span class="pl-s1">andas</span>\p<span class="pl-s1">andas</span>\c<span class="pl-s1">ore</span>\i<span class="pl-s1">nternals</span>.<span class="pl-s1">pyc</span> <span class="pl-c1">in</span> <span class="pl-en">__init__</span>(<span class="pl-s1">self</span>, <span class="pl-s1">blocks</span>, <span class="pl-s1">axes</span>, <span class="pl-s1">do_integrity_check</span>, <span class="pl-s1">fastpath</span>)
   <span class="pl-c1">2880</span>                     <span class="pl-k">raise</span> <span class="pl-v">AssertionError</span>(<span class="pl-s">'Number of Block dimensions (%d) '</span>
   <span class="pl-c1">2881</span>                                          <span class="pl-s">'must equal number of axes (%d)'</span> <span class="pl-c1">%</span>
<span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-c1">2882</span>                                          (<span class="pl-s1">block</span>.<span class="pl-s1">ndim</span>, <span class="pl-s1">self</span>.<span class="pl-s1">ndim</span>))
   <span class="pl-c1">2883</span>
   <span class="pl-c1">2884</span>         <span class="pl-k">if</span> <span class="pl-s1">do_integrity_check</span>:

<span class="pl-v">AssertionError</span>: <span class="pl-v">Number</span> <span class="pl-s1">of</span> <span class="pl-v">Block</span> <span class="pl-en">dimensions</span> (<span class="pl-c1">1</span>) <span class="pl-s1">must</span> <span class="pl-s1">equal</span> <span class="pl-s1">number</span> <span class="pl-s1">of</span> <span class="pl-en">axes</span> (<span class="pl-c1">2</span>)</pre></div>
<h4 dir="auto">Problem description</h4>
<p dir="auto">Transpose on dataframe with timestamps columns work. But, if columns consist of timestamps with time-zone, it fails.</p>
<h4 dir="auto">Output of <code class="notranslate">pd.show_versions()</code></h4>
<details>
INSTALLED VERSIONS
------------------
commit: None
python: 2.7.12.final.0
python-bits: 64
OS: Windows
OS-release: 7
machine: AMD64
processor: Intel64 Family 6 Model 61 Stepping 4, GenuineIntel
byteorder: little
LC_ALL: None
LANG: None
LOCALE: None.None
<p dir="auto">pandas: 0.21.0.dev+413.g7f93d2d<br>
pytest: 3.2.0<br>
pip: 9.0.1<br>
setuptools: 36.2.7<br>
Cython: 0.24.1<br>
numpy: 1.12.1<br>
scipy: 0.19.1<br>
pyarrow: None<br>
xarray: None<br>
IPython: 5.1.0<br>
sphinx: 1.4.6<br>
patsy: 0.4.1<br>
dateutil: 2.5.3<br>
pytz: 2017.2<br>
blosc: None<br>
bottleneck: 1.2.0<br>
tables: 3.2.2<br>
numexpr: 2.6.2<br>
feather: None<br>
matplotlib: 2.0.2<br>
openpyxl: 2.3.2<br>
xlrd: 1.0.0<br>
xlwt: 1.1.2<br>
xlsxwriter: 0.9.3<br>
lxml: 3.6.4<br>
bs4: 4.5.1<br>
html5lib: 0.999999999<br>
sqlalchemy: 1.0.13<br>
pymysql: 0.7.9.None<br>
psycopg2: 2.7.3.1 (dt dec pq3 ext lo64)<br>
jinja2: 2.8<br>
s3fs: None<br>
fastparquet: None<br>
pandas_gbq: None<br>
pandas_datareader: None</p>
</details>
<p dir="auto">I have the following array of Timestamps:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="ts_array = np.array([[Timestamp('2016-05-02 15:50:00+0000', tz='UTC', offset='5T'),
        Timestamp('2016-05-02 15:50:00+0000', tz='UTC', offset='5T'),
        Timestamp('2016-05-02 15:50:00+0000', tz='UTC', offset='5T')],
       [Timestamp('2016-05-02 17:10:00+0000', tz='UTC', offset='5T'),
        Timestamp('2016-05-02 17:10:00+0000', tz='UTC', offset='5T'),
        Timestamp('2016-05-02 17:10:00+0000', tz='UTC', offset='5T')],
       [Timestamp('2016-05-02 20:25:00+0000', tz='UTC', offset='5T'),
        Timestamp('2016-05-02 20:25:00+0000', tz='UTC', offset='5T'),
        Timestamp('2016-05-02 20:25:00+0000', tz='UTC', offset='5T')]], dtype=object)"><pre class="notranslate"><span class="pl-s1">ts_array</span> <span class="pl-c1">=</span> <span class="pl-s1">np</span>.<span class="pl-en">array</span>([[<span class="pl-v">Timestamp</span>(<span class="pl-s">'2016-05-02 15:50:00+0000'</span>, <span class="pl-s1">tz</span><span class="pl-c1">=</span><span class="pl-s">'UTC'</span>, <span class="pl-s1">offset</span><span class="pl-c1">=</span><span class="pl-s">'5T'</span>),
        <span class="pl-v">Timestamp</span>(<span class="pl-s">'2016-05-02 15:50:00+0000'</span>, <span class="pl-s1">tz</span><span class="pl-c1">=</span><span class="pl-s">'UTC'</span>, <span class="pl-s1">offset</span><span class="pl-c1">=</span><span class="pl-s">'5T'</span>),
        <span class="pl-v">Timestamp</span>(<span class="pl-s">'2016-05-02 15:50:00+0000'</span>, <span class="pl-s1">tz</span><span class="pl-c1">=</span><span class="pl-s">'UTC'</span>, <span class="pl-s1">offset</span><span class="pl-c1">=</span><span class="pl-s">'5T'</span>)],
       [<span class="pl-v">Timestamp</span>(<span class="pl-s">'2016-05-02 17:10:00+0000'</span>, <span class="pl-s1">tz</span><span class="pl-c1">=</span><span class="pl-s">'UTC'</span>, <span class="pl-s1">offset</span><span class="pl-c1">=</span><span class="pl-s">'5T'</span>),
        <span class="pl-v">Timestamp</span>(<span class="pl-s">'2016-05-02 17:10:00+0000'</span>, <span class="pl-s1">tz</span><span class="pl-c1">=</span><span class="pl-s">'UTC'</span>, <span class="pl-s1">offset</span><span class="pl-c1">=</span><span class="pl-s">'5T'</span>),
        <span class="pl-v">Timestamp</span>(<span class="pl-s">'2016-05-02 17:10:00+0000'</span>, <span class="pl-s1">tz</span><span class="pl-c1">=</span><span class="pl-s">'UTC'</span>, <span class="pl-s1">offset</span><span class="pl-c1">=</span><span class="pl-s">'5T'</span>)],
       [<span class="pl-v">Timestamp</span>(<span class="pl-s">'2016-05-02 20:25:00+0000'</span>, <span class="pl-s1">tz</span><span class="pl-c1">=</span><span class="pl-s">'UTC'</span>, <span class="pl-s1">offset</span><span class="pl-c1">=</span><span class="pl-s">'5T'</span>),
        <span class="pl-v">Timestamp</span>(<span class="pl-s">'2016-05-02 20:25:00+0000'</span>, <span class="pl-s1">tz</span><span class="pl-c1">=</span><span class="pl-s">'UTC'</span>, <span class="pl-s1">offset</span><span class="pl-c1">=</span><span class="pl-s">'5T'</span>),
        <span class="pl-v">Timestamp</span>(<span class="pl-s">'2016-05-02 20:25:00+0000'</span>, <span class="pl-s1">tz</span><span class="pl-c1">=</span><span class="pl-s">'UTC'</span>, <span class="pl-s1">offset</span><span class="pl-c1">=</span><span class="pl-s">'5T'</span>)]], <span class="pl-s1">dtype</span><span class="pl-c1">=</span><span class="pl-s1">object</span>)</pre></div>
<p dir="auto">I can't create a DataFrame from this array using the DataFrame constructor:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="pd.DataFrame(ts_array)"><pre class="notranslate"><span class="pl-s1">pd</span>.<span class="pl-v">DataFrame</span>(<span class="pl-s1">ts_array</span>)</pre></div>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Traceback (most recent call last):
  File &quot;/Users/jkelleher/anaconda/lib/python2.7/site-packages/IPython/core/interactiveshell.py&quot;, line 2885, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File &quot;&lt;ipython-input-46-ae20c6b6248f&gt;&quot;, line 1, in &lt;module&gt;
    pd.DataFrame(ts_array)
  File &quot;/Users/jkelleher/anaconda/lib/python2.7/site-packages/pandas/core/frame.py&quot;, line 255, in __init__
    copy=copy)
  File &quot;/Users/jkelleher/anaconda/lib/python2.7/site-packages/pandas/core/frame.py&quot;, line 432, in _init_ndarray
    return create_block_manager_from_blocks([values], [columns, index])
  File &quot;/Users/jkelleher/anaconda/lib/python2.7/site-packages/pandas/core/internals.py&quot;, line 3986, in create_block_manager_from_blocks
    mgr = BlockManager(blocks, axes)
  File &quot;/Users/jkelleher/anaconda/lib/python2.7/site-packages/pandas/core/internals.py&quot;, line 2591, in __init__
    (block.ndim, self.ndim))
AssertionError: Number of Block dimensions (1) must equal number of axes (2)"><pre class="notranslate"><code class="notranslate">Traceback (most recent call last):
  File "/Users/jkelleher/anaconda/lib/python2.7/site-packages/IPython/core/interactiveshell.py", line 2885, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "&lt;ipython-input-46-ae20c6b6248f&gt;", line 1, in &lt;module&gt;
    pd.DataFrame(ts_array)
  File "/Users/jkelleher/anaconda/lib/python2.7/site-packages/pandas/core/frame.py", line 255, in __init__
    copy=copy)
  File "/Users/jkelleher/anaconda/lib/python2.7/site-packages/pandas/core/frame.py", line 432, in _init_ndarray
    return create_block_manager_from_blocks([values], [columns, index])
  File "/Users/jkelleher/anaconda/lib/python2.7/site-packages/pandas/core/internals.py", line 3986, in create_block_manager_from_blocks
    mgr = BlockManager(blocks, axes)
  File "/Users/jkelleher/anaconda/lib/python2.7/site-packages/pandas/core/internals.py", line 2591, in __init__
    (block.ndim, self.ndim))
AssertionError: Number of Block dimensions (1) must equal number of axes (2)
</code></pre></div>
<p dir="auto">I can create the DataFrame from the array using <code class="notranslate">from_records</code>:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="ts_df = pd.DataFrame.from_records(ts_array)"><pre class="notranslate"><span class="pl-s1">ts_df</span> <span class="pl-c1">=</span> <span class="pl-s1">pd</span>.<span class="pl-v">DataFrame</span>.<span class="pl-en">from_records</span>(<span class="pl-s1">ts_array</span>)</pre></div>
<p dir="auto">However, when I attempt to transpose this DataFrame, I wind up with the same <code class="notranslate">AssertionError</code> as before.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="AssertionError: Number of Block dimensions (1) must equal number of axes (2)"><pre class="notranslate"><code class="notranslate">AssertionError: Number of Block dimensions (1) must equal number of axes (2)
</code></pre></div>
<p dir="auto">If I convert the Timestamps to Datetimes, the error persists. I can, however, convert the Timestamps to Datetime64 objects, and this fixes the problem.</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="dt64_array = np.array([[ts.to_datetime64() for ts in sublist] for sublist in ts_array])
pd.DataFrame(dt64_array)"><pre class="notranslate"><span class="pl-s1">dt64_array</span> <span class="pl-c1">=</span> <span class="pl-s1">np</span>.<span class="pl-en">array</span>([[<span class="pl-s1">ts</span>.<span class="pl-en">to_datetime64</span>() <span class="pl-k">for</span> <span class="pl-s1">ts</span> <span class="pl-c1">in</span> <span class="pl-s1">sublist</span>] <span class="pl-k">for</span> <span class="pl-s1">sublist</span> <span class="pl-c1">in</span> <span class="pl-s1">ts_array</span>])
<span class="pl-s1">pd</span>.<span class="pl-v">DataFrame</span>(<span class="pl-s1">dt64_array</span>)</pre></div>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Out[56]: 
                    0                   1                   2
0 2016-05-02 15:50:00 2016-05-02 15:50:00 2016-05-02 15:50:00
1 2016-05-02 17:10:00 2016-05-02 17:10:00 2016-05-02 17:10:00
2 2016-05-02 20:25:00 2016-05-02 20:25:00 2016-05-02 20:25:00"><pre class="notranslate"><code class="notranslate">Out[56]: 
                    0                   1                   2
0 2016-05-02 15:50:00 2016-05-02 15:50:00 2016-05-02 15:50:00
1 2016-05-02 17:10:00 2016-05-02 17:10:00 2016-05-02 17:10:00
2 2016-05-02 20:25:00 2016-05-02 20:25:00 2016-05-02 20:25:00
</code></pre></div>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="pd.DataFrame(dt64_array).transpose()"><pre class="notranslate"><span class="pl-s1">pd</span>.<span class="pl-v">DataFrame</span>(<span class="pl-s1">dt64_array</span>).<span class="pl-en">transpose</span>()</pre></div>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Out[57]: 
                    0                   1                   2
0 2016-05-02 15:50:00 2016-05-02 17:10:00 2016-05-02 20:25:00
1 2016-05-02 15:50:00 2016-05-02 17:10:00 2016-05-02 20:25:00
2 2016-05-02 15:50:00 2016-05-02 17:10:00 2016-05-02 20:25:00"><pre class="notranslate"><code class="notranslate">Out[57]: 
                    0                   1                   2
0 2016-05-02 15:50:00 2016-05-02 17:10:00 2016-05-02 20:25:00
1 2016-05-02 15:50:00 2016-05-02 17:10:00 2016-05-02 20:25:00
2 2016-05-02 15:50:00 2016-05-02 17:10:00 2016-05-02 20:25:00
</code></pre></div>
<p dir="auto">Though I found a suitable workaround, I feel like pandas should be able to construct and operate on DataFrames of Timestamps as easily as other other objects.</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.11.final.0
python-bits: 64
OS: Darwin
OS-release: 15.5.0
machine: x86_64
processor: i386
byteorder: little
LC_ALL: None
LANG: None

pandas: 0.18.1
nose: 1.3.7
pip: 8.1.2
setuptools: 20.3
Cython: 0.24
numpy: 1.11.0
scipy: 0.17.1
statsmodels: 0.8.0.dev0+970e99e
xarray: None
IPython: 4.1.2
sphinx: 1.3.5
patsy: 0.4.0
dateutil: 2.5.3
pytz: 2016.4
blosc: None
bottleneck: 1.0.0
tables: 3.2.2
numexpr: 2.5
matplotlib: 1.5.1
openpyxl: 2.3.2
xlrd: 0.9.4
xlwt: 1.0.0
xlsxwriter: 0.8.4
lxml: 3.6.0
bs4: 4.4.1
html5lib: None
httplib2: None
apiclient: None
sqlalchemy: 1.0.12
pymysql: None
psycopg2: None
jinja2: 2.8
boto: 2.39.0
pandas_datareader: None"><pre class="notranslate"><code class="notranslate">INSTALLED VERSIONS
------------------
commit: None
python: 2.7.11.final.0
python-bits: 64
OS: Darwin
OS-release: 15.5.0
machine: x86_64
processor: i386
byteorder: little
LC_ALL: None
LANG: None

pandas: 0.18.1
nose: 1.3.7
pip: 8.1.2
setuptools: 20.3
Cython: 0.24
numpy: 1.11.0
scipy: 0.17.1
statsmodels: 0.8.0.dev0+970e99e
xarray: None
IPython: 4.1.2
sphinx: 1.3.5
patsy: 0.4.0
dateutil: 2.5.3
pytz: 2016.4
blosc: None
bottleneck: 1.0.0
tables: 3.2.2
numexpr: 2.5
matplotlib: 1.5.1
openpyxl: 2.3.2
xlrd: 0.9.4
xlwt: 1.0.0
xlsxwriter: 0.8.4
lxml: 3.6.0
bs4: 4.4.1
html5lib: None
httplib2: None
apiclient: None
sqlalchemy: 1.0.12
pymysql: None
psycopg2: None
jinja2: 2.8
boto: 2.39.0
pandas_datareader: None
</code></pre></div>