Skip to content

Commit 9c6d7d7

Browse files
code sample for pandas-dev#47284
1 parent 5d98799 commit 9c6d7d7

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

bisect/47284.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# REGR: assignment of pd.NA with enlargement gives object dtype with IntegerArray #47284
2+
3+
import pandas as pd
4+
5+
print(pd.__version__)
6+
7+
# gets upcast to object
8+
df = pd.DataFrame({"a": [1, 2, 3]}, dtype="Int64")
9+
df.loc[4] = pd.NA
10+
print(df.dtypes)
11+
12+
expected = pd.DataFrame(
13+
{"a": [1, 2, 3, None]},
14+
dtype="Int64",
15+
index=pd.Int64Index([0, 1, 2, 4], dtype="int64"),
16+
)
17+
pd.testing.assert_frame_equal(df, expected)

0 commit comments

Comments
 (0)