Open
Description
Example
>>> import numpy as np
>>> import pandas as pd
>>> a = np.array([1,2,3])
>>> c = pd.DataFrame({0: ["a", "b", "c"]}, index=a)
>>> print(c)
0
1 a
2 b
3 c
>>> d = pd.DataFrame({1: ["d", "e", "f"]}, index=a)
>>> print(d)
1
1 d
2 e
3 f
>>> cd_df = pd.concat([c,d], axis=1, copy=True)
>>> a[0] = 9
>>> cd_df # Changed
0 1
9 a d
2 b e
3 c f
When indexes are the same, concat with axis=1, and copy=True doesn't copy the index.
Originally discovered in #37441 (index was not copied, and was a view pointing to the original ndarray read by PyTables, preventing it from being freed).