df = df.copy() inside function code example Example: dataframe copy new_dataframe = dataframe.copy(deep = True)