Skip to content

Commit f74e926

Browse files
code sample for pandas-dev#47578
1 parent 2683ab5 commit f74e926

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

bisect/47578.py

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# BUG: Setting a DataFrame as rhs with loc on a single column does not align in the single
2+
# block case #47578
3+
4+
import numpy as np
5+
import pandas as pd
6+
7+
print(pd.__version__)
8+
9+
result = pd.DataFrame({"var": [1, 2]}, index=[1, 2])
10+
rhs = pd.DataFrame({"var": [10, 11]}, index=[2, 3])
11+
result.loc[:, "var"] = rhs
12+
print(result)
13+
14+
expected = pd.DataFrame({"var": [np.nan, 10]}, index=[1, 2])
15+
pd.testing.assert_frame_equal(result, expected)

0 commit comments

Comments
 (0)