In pandas, can I deeply copy a DataFrame including its index and column?

Latest version of Pandas does not have this issue anymore

  import pandas as pd
  df = pd.DataFrame([[1], [2], [3]])

  df2 = df.copy(deep=True)

  id(df), id(df2)
  Out[3]: (136575472, 127792400)

  id(df.index), id(df2.index)
  Out[4]: (145820144, 127657008)

Leave a Comment