Skip to content

Commit

Permalink
code sample for pandas-dev#46268
Browse files Browse the repository at this point in the history
  • Loading branch information
simonjayhawkins committed Apr 5, 2022
1 parent f20c184 commit a77bbf3
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions bisect/46268.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# BUG: Unexpected jupyter notebook behavior when assigning an array.array variable #46268

from array import array

import numpy as np

import pandas as pd

print(pd.__version__)


df = pd.DataFrame({"A": [2, 4, 6, 8]})

cenlon = array("d")
cenlon.append(45.345343)

# Problem
df.loc[0, "CenLon"] = cenlon
print(df)

expected = pd.DataFrame(
{"A": [2, 4, 6, 8], "CenLon": [45.345343, np.nan, np.nan, np.nan]}
)
pd.testing.assert_frame_equal(df, expected)

0 comments on commit a77bbf3

Please sign in to comment.