We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent dbd6d5a commit f47bd96Copy full SHA for f47bd96
bisect/45621.py
@@ -0,0 +1,15 @@
1
+# BUG: 1.4.0 does not preserve initially empty Index and appended by loc assignment. #45621
2
+
3
+import pandas as pd
4
5
+print(pd.__version__)
6
7
+df = pd.DataFrame(columns=["a", "b"]).set_index("a")
8
+print(df.index, id(df.index)) # Index([], dtype='object', name='a') 4644041536
9
10
+df.loc[0] = {"b": 0}
11
+result = df.index
12
+print(result, id(df.index)) # Int64Index([0], dtype='int64') 4726025904
13
14
+expected = pd.Index([0], dtype="int64", name="a")
15
+pd.testing.assert_index_equal(result, expected)
0 commit comments