I am having a problem with replacing a specific column using its index in a dataframe with a new dataframe that consists of only 1 column given that they both have the same length
I need to replace the column only knowing its index as I am choosing a random column to replace in the dataframe df that contains 8 columns with the new dataframe df_temp that only has 1 column
N=random.randint(1,8)
df.iloc(: , [N - 1]) = df_temp.values
This gives me syntax error I don't know if I am using the .iloc wrong or there is an alternative way to do that.