Skip to content

Commit f6ca227

Browse files
code sample for pandas-dev#47294
1 parent 584f9cf commit f6ca227

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

bisect/47294.py

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# BUG: uint16 inserted as int16 when assigning row with dict #47294
2+
3+
import pandas as pd
4+
import numpy as np
5+
6+
print(pd.__version__)
7+
8+
df = pd.DataFrame(columns=["actual", "reference"])
9+
df.loc[0] = {"actual": np.uint16(40_000), "reference": "nope"}
10+
11+
print(df)
12+
print(df.dtypes)
13+
14+
expected = pd.DataFrame(
15+
{"actual": [np.uint16(40_000)], "reference": ["nope"]}, dtype=object
16+
)
17+
pd.testing.assert_frame_equal(df, expected)

0 commit comments

Comments
 (0)