<p dir="auto">xref <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="46428546" data-permission-text="Title is private" data-url="https://github.com/pandas-dev/pandas/issues/8596" data-hovercard-type="issue" data-hovercard-url="/pandas-dev/pandas/issues/8596/hovercard" href="https://github.com/pandas-dev/pandas/issues/8596">#8596</a></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&gt;&gt;&gt; df
   a
0  1
&gt;&gt;&gt; df.dtypes
a    int64
dtype: object
&gt;&gt;&gt; df.loc[1, 'a'] = 2
&gt;&gt;&gt; df
   a
0  1
1  2
&gt;&gt;&gt; df.dtypes
a    float64
dtype: object"><pre class="notranslate"><code class="notranslate">&gt;&gt;&gt; df
   a
0  1
&gt;&gt;&gt; df.dtypes
a    int64
dtype: object
&gt;&gt;&gt; df.loc[1, 'a'] = 2
&gt;&gt;&gt; df
   a
0  1
1  2
&gt;&gt;&gt; df.dtypes
a    float64
dtype: object
</code></pre></div>
<p dir="auto">in an intermediate step <code class="notranslate">nan</code> is inserted, and the data are casted to floats</p>
<p dir="auto"><a href="http://stackoverflow.com/questions/22044766/adding-row-to-pandas-dataframe-changes-dtype/22045011#22045011" rel="nofollow">http://stackoverflow.com/questions/22044766/adding-row-to-pandas-dataframe-changes-dtype/22045011#22045011</a></p>
<p dir="auto">A bit non-trival (maybe coerce back after) if possible?</p>
<p dir="auto">maybe just change this to an actual append?</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="In [1]: df = DataFrame({'a' : range(10)}, dtype='i4')

In [2]: df
Out[2]: 
   a
0  0
1  1
2  2
3  3
4  4
5  5
6  6
7  7
8  8
9  9

[10 rows x 1 columns]

In [3]: df.dtypes
Out[3]: 
a    int32
dtype: object

In [4]: df.loc[10] = 99

In [5]: df
Out[5]: 
     a
0    0
1    1
2    2
3    3
4    4
5    5
6    6
7    7
8    8
9    9
10  99

[11 rows x 1 columns]

In [6]: df.dtypes
Out[6]: 
a    float64
dtype: object
"><pre class="notranslate"><code class="notranslate">In [1]: df = DataFrame({'a' : range(10)}, dtype='i4')

In [2]: df
Out[2]: 
   a
0  0
1  1
2  2
3  3
4  4
5  5
6  6
7  7
8  8
9  9

[10 rows x 1 columns]

In [3]: df.dtypes
Out[3]: 
a    int32
dtype: object

In [4]: df.loc[10] = 99

In [5]: df
Out[5]: 
     a
0    0
1    1
2    2
3    3
4    4
5    5
6    6
7    7
8    8
9    9
10  99

[11 rows x 1 columns]

In [6]: df.dtypes
Out[6]: 
a    float64
dtype: object

</code></pre></div>