Skip to content

Commit a77bbf3

Browse files
code sample for pandas-dev#46268
1 parent f20c184 commit a77bbf3

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

bisect/46268.py

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# BUG: Unexpected jupyter notebook behavior when assigning an array.array variable #46268
2+
3+
from array import array
4+
5+
import numpy as np
6+
7+
import pandas as pd
8+
9+
print(pd.__version__)
10+
11+
12+
df = pd.DataFrame({"A": [2, 4, 6, 8]})
13+
14+
cenlon = array("d")
15+
cenlon.append(45.345343)
16+
17+
# Problem
18+
df.loc[0, "CenLon"] = cenlon
19+
print(df)
20+
21+
expected = pd.DataFrame(
22+
{"A": [2, 4, 6, 8], "CenLon": [45.345343, np.nan, np.nan, np.nan]}
23+
)
24+
pd.testing.assert_frame_equal(df, expected)

0 commit comments

Comments
 (0)