Suppose I have this code:
import pandas as pd
mylist = [item for item in range(100000)]
df = pd.DataFrame()
df["col1"] = mylist
Is the data in mylist
copied when it is assigned to df["col1"]
? If so, is there a way to avoid this copy?
Edit: My list in this case is a list of strings. One things I am getting from these answers is if I instead create a numpy array of these strings, no data duplication will occur I call df["col1"] = mynparray
?