<h4 dir="auto">Code Sample, a copy-pastable example if possible</h4>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="data = {'name':['John', 'Anderson'], 'date':[pd.Timestamp(2017,3,13,13,32,56), pd.Timestamp(2017,2,16,12,10,3)]}
test_df = pd.DataFrame(data=data)
test_df['date'] = test_df['date'].map(lambda x:x.tz_localize('Asia/Shanghai'))

In [18]: test_df.at[0,'date']
Out[18]: Timestamp('2017-03-13 05:32:56')

In [19]: test_df.loc[0,'date']
Out[19]: Timestamp('2017-03-13 13:32:56+0800', tz='Asia/Shanghai')"><pre class="notranslate"><code class="notranslate">data = {'name':['John', 'Anderson'], 'date':[pd.Timestamp(2017,3,13,13,32,56), pd.Timestamp(2017,2,16,12,10,3)]}
test_df = pd.DataFrame(data=data)
test_df['date'] = test_df['date'].map(lambda x:x.tz_localize('Asia/Shanghai'))

In [18]: test_df.at[0,'date']
Out[18]: Timestamp('2017-03-13 05:32:56')

In [19]: test_df.loc[0,'date']
Out[19]: Timestamp('2017-03-13 13:32:56+0800', tz='Asia/Shanghai')
</code></pre></div>
<h4 dir="auto">Problem description</h4>
<p dir="auto">The sample code is as above.<br>
I have a column in DataFrame that contains the datetime values which are Timestamp object in pandas.<br>
After I localise the timestamp, while using .at getter and .loc getter, I get different results.<br>
One is without time zone info, the other is with time zone info.</p>
<p dir="auto">Is this a bug? How can I get the timestamp with time zone info using ".at" getter?</p>
<h4 dir="auto">Expected Output</h4>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="test_df.at[0,'date']
Timestamp('2017-03-13 13:32:56+0800', tz='Asia/Shanghai')"><pre class="notranslate"><code class="notranslate">test_df.at[0,'date']
Timestamp('2017-03-13 13:32:56+0800', tz='Asia/Shanghai')
</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
<p dir="auto">In [20]: pd.show_versions()</p>
<h2 dir="auto">INSTALLED VERSIONS</h2>
<p dir="auto">commit: None<br>
python: 2.7.6.final.0<br>
python-bits: 64<br>
OS: Linux<br>
OS-release: 3.19.0-66-generic<br>
machine: x86_64<br>
processor: x86_64<br>
byteorder: little<br>
LC_ALL: None<br>
LANG: en_HK.UTF-8<br>
LOCALE: None.None</p>
<p dir="auto">pandas: 0.19.2<br>
nose: 1.3.7<br>
pip: 9.0.1<br>
setuptools: 25.1.1<br>
Cython: 0.24.1<br>
numpy: 1.12.1<br>
scipy: 0.18.1<br>
statsmodels: None<br>
xarray: None<br>
IPython: 5.0.0<br>
sphinx: None<br>
patsy: None<br>
dateutil: 2.6.0<br>
pytz: 2016.10<br>
blosc: None<br>
bottleneck: None<br>
tables: None<br>
numexpr: None<br>
matplotlib: 1.5.1<br>
openpyxl: None<br>
xlrd: None<br>
xlwt: None<br>
xlsxwriter: None<br>
lxml: None<br>
bs4: None<br>
html5lib: 0.999<br>
httplib2: 0.8<br>
apiclient: None<br>
sqlalchemy: None<br>
pymysql: None<br>
psycopg2: None<br>
jinja2: None<br>
boto: None<br>
pandas_datareader: None</p>
</details>
<p dir="auto">Related to <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="35279505" data-permission-text="Title is private" data-url="https://github.com/pandas-dev/pandas/issues/7401" data-hovercard-type="issue" data-hovercard-url="/pandas-dev/pandas/issues/7401/hovercard" href="https://github.com/pandas-dev/pandas/issues/7401">#7401</a>, but another issue I think. Some more strange behaviour with NaNs in the index when unstacking (but now not specifically to datetime).</p>
<p dir="auto">First case:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="In [9]: df = pd.DataFrame({'A': list('aaaabbbb'),
   ...:                    'B':range(8),
   ...:                    'C':range(8)})

In [10]: df.set_index(['A', 'B']).unstack(0)
Out[10]:
    C
A   a   b
B
0   0 NaN
1   1 NaN
2   2 NaN
3   3 NaN
4 NaN   4
5 NaN   5
6 NaN   6
7 NaN   7

In [11]: df.iloc[3,1] = np.NaN

In [12]: df.set_index(['A', 'B']).unstack(0)
Out[12]:
      C
A     a   b
B
 0    3 NaN
 1    0 NaN
 2    1 NaN
NaN NaN NaN
 4  NaN   2
 5  NaN   4
 6  NaN   5
 7    6   7"><pre class="notranslate"><code class="notranslate">In [9]: df = pd.DataFrame({'A': list('aaaabbbb'),
   ...:                    'B':range(8),
   ...:                    'C':range(8)})

In [10]: df.set_index(['A', 'B']).unstack(0)
Out[10]:
    C
A   a   b
B
0   0 NaN
1   1 NaN
2   2 NaN
3   3 NaN
4 NaN   4
5 NaN   5
6 NaN   6
7 NaN   7

In [11]: df.iloc[3,1] = np.NaN

In [12]: df.set_index(['A', 'B']).unstack(0)
Out[12]:
      C
A     a   b
B
 0    3 NaN
 1    0 NaN
 2    1 NaN
NaN NaN NaN
 4  NaN   2
 5  NaN   4
 6  NaN   5
 7    6   7
</code></pre></div>
<p dir="auto">The values in the first column are totally mixed up.</p>
<p dir="auto">Second case (with repeating values in the second level):</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="In [13]: df = pd.DataFrame({'A': list('aaaabbbb'),
   ....:                    'B':range(4)*2,
   ....:                    'C':range(8)})
In [14]: df
Out[14]:
   A  B  C
0  a  0  0
1  a  1  1
2  a  2  2
3  a  3  3
4  b  0  4
5  b  1  5
6  b  2  6
7  b  3  7

In [15]: df.set_index(['A', 'B']).unstack(0)
Out[15]:
   C
A  a  b
B
0  0  4
1  1  5
2  2  6
3  3  7

In [16]: df.iloc[2,1] = np.NaN

In [17]: df.set_index(['A', 'B']).unstack(0)
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
&lt;ipython-input-17-2f4735e48b98&gt; in &lt;module&gt;()
----&gt; 1 df.set_index(['A', 'B']).unstack(0)

...

c:\users\vdbosscj\scipy\pandas-joris\pandas\core\reshape.pyc in _make_selectors(
self)
    139
    140         if mask.sum() &lt; len(self.index):
--&gt; 141             raise ValueError('Index contains duplicate entries, '
    142                              'cannot reshape')
    143

ValueError: Index contains duplicate entries, cannot reshape"><pre class="notranslate"><code class="notranslate">In [13]: df = pd.DataFrame({'A': list('aaaabbbb'),
   ....:                    'B':range(4)*2,
   ....:                    'C':range(8)})
In [14]: df
Out[14]:
   A  B  C
0  a  0  0
1  a  1  1
2  a  2  2
3  a  3  3
4  b  0  4
5  b  1  5
6  b  2  6
7  b  3  7

In [15]: df.set_index(['A', 'B']).unstack(0)
Out[15]:
   C
A  a  b
B
0  0  4
1  1  5
2  2  6
3  3  7

In [16]: df.iloc[2,1] = np.NaN

In [17]: df.set_index(['A', 'B']).unstack(0)
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
&lt;ipython-input-17-2f4735e48b98&gt; in &lt;module&gt;()
----&gt; 1 df.set_index(['A', 'B']).unstack(0)

...

c:\users\vdbosscj\scipy\pandas-joris\pandas\core\reshape.pyc in _make_selectors(
self)
    139
    140         if mask.sum() &lt; len(self.index):
--&gt; 141             raise ValueError('Index contains duplicate entries, '
    142                              'cannot reshape')
    143

ValueError: Index contains duplicate entries, cannot reshape
</code></pre></div>
<p dir="auto">and another error message with the NaN on the last place (of the sublevel):</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="In [20]: df = pd.DataFrame({'A': list('aaaabbbb'),
   ....:                    'B':range(4)*2,
   ....:                    'C':range(8)})
In [21]: df.iloc[3,1] = np.NaN

In [22]: df.set_index(['A', 'B']).unstack(0)
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)

...

c:\users\vdbosscj\scipy\pandas-joris\pandas\core\reshape.pyc in get_result(self)

    173                 values_indexer = com._ensure_int64(l[~mask])
    174                 for i, j in enumerate(values_indexer):
--&gt; 175                     values[j] = orig_values[i]
    176             else:
    177                 index = index.take(self.unique_groups)

IndexError: index 4 is out of bounds for axis 0 with size 4"><pre class="notranslate"><code class="notranslate">In [20]: df = pd.DataFrame({'A': list('aaaabbbb'),
   ....:                    'B':range(4)*2,
   ....:                    'C':range(8)})
In [21]: df.iloc[3,1] = np.NaN

In [22]: df.set_index(['A', 'B']).unstack(0)
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)

...

c:\users\vdbosscj\scipy\pandas-joris\pandas\core\reshape.pyc in get_result(self)

    173                 values_indexer = com._ensure_int64(l[~mask])
    174                 for i, j in enumerate(values_indexer):
--&gt; 175                     values[j] = orig_values[i]
    176             else:
    177                 index = index.take(self.unique_groups)

IndexError: index 4 is out of bounds for axis 0 with size 4
</code></pre></div>
<p dir="auto">I know NaNs in the index is not really recommended, but just exploring this (as I was caught by such an issue, you don't always think of looking if you have NaNs if you get such errors)</p>