pydata/pandas — Issue #839: int64 Series and NA assignment
Author: adamklein
Created: 2012-02-29 00:19:35+00:00
State: open
Labels: Bug, prio-high

I think a bug:

In [1]: s = Series(arange(10))

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

In [3]: s[::2] = np.nan

In [4]: s
Out[4]:
0 -9223372036854775808
1 1
2 -9223372036854775808
3 3
4 -9223372036854775808
5 5
6 -9223372036854775808
7 7
8 -9223372036854775808
9 9

In [5]: s.dtype
Out[5]: dtype('int64')

Dataframe seems fine:

In [12]: df = DataFrame(np.random.random_integers(5, size=(5,5)))

In [13]: df
Out[13]:
0 1 2 3 4
0 5 5 3 1 2
1 1 3 3 3 2
2 1 5 2 2 3
3 5 3 1 1 4
4 2 5 2 3 2

In [14]: df[2] = np.nan

In [15]: df
Out[15]:
0 1 2 3 4
0 5 5 NaN 1 2
1 1 3 NaN 3 2
2 1 5 NaN 2 3
3 5 3 NaN 1 4
4 2 5 NaN 3 2