For a column in a pandas DataFrame with multiple rows, I want to create a new column with the specified number of rows that form the row subselect of the previous column. I am trying to do this in order to create a large data matrix containing ranges of values as input for the model later.
As an example, I have a small DataFrame as follows:
df:
A
1 1
2 2
3 3
. ..
In this DataFrame, I would like to add 3 rows to the row in the “A” column of the DataFrame, forming a new column named “B”. The result should be something like this:
df:
A B
1 1 1
2 1 2
3 1 3
4 2 1
5 2 2
6 2 3
7 3 1
8 3 2
9 3 3
. .. ..
, if - DataFrame, iterrows() "" , , . "A".
- , ?
,