Create Dataframe with a certain number of columns
Question:
I have the following Dataframe:
Now i want to copy the column "Power" as often as i want to another column in the same Dataframe.
The column names should be: Power_1; Power_2; Power_3…..
Creating the Dataframe is too complicated to share, but a simple example how to add the columns with a while-loop would be sufficient.
Answers:
for i in range(10):
df[f"Power_{i}"] = df["Power"]
I have the following Dataframe:
Now i want to copy the column "Power" as often as i want to another column in the same Dataframe.
The column names should be: Power_1; Power_2; Power_3…..
Creating the Dataframe is too complicated to share, but a simple example how to add the columns with a while-loop would be sufficient.
for i in range(10):
df[f"Power_{i}"] = df["Power"]