I have a dataframe "df\_edges" where I want to iterate over.
Inside the iteration is an if/else and a string split. I need to add the values from the if/else into a new dataframe (each iteration = one new row in the other dataframe).

Example data of "df\_edges":

```
+-----------------------------------------+
| channelId ... featuredChannelsUrlsCount |
+-----------------------------------------+
| 0  UC-ry8ngUIJHTMBWeoARZGmA  ... 1      |
| 1  UC-zK3cJdazy01AKTu8g_amg  ... 6      |
| 2  UC05_iIGvXue0sR01JNpRHzw  ... 10     |
| 3  UC141nSav5cjmTXN7B70ts0g  ... 0      |
| 4  UC1cQzKmbx9x0KipvoCt4NJg  ... 0      |

```

+-----------------------------------------+

```
# new empty dataframe where I want to add the values
df_edges_to_db = pd.DataFrame(columns=["Source", "Target"])

#iteration over the dataframe
for row in df_edges.itertuples():
    if row.featuredChannelsUrlsCount != 0:
        featured_channels = row[2].split(',')
        for fc in featured_channels:
            writer.writerow([row[1], fc])
            df_edges_to_db = df_edges_to_db.append({"Source": row[1], "Target": fc}, ignore_index=True)
    else:
        writer.writerow([row[1], row[1]])
        df_edges_to_db = df_edges_to_db.append({"Source": row[1], "Target": row[1]}, ignore_index=True)

```

This seems to work. But the documentation says (<https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.append.html>):

> 
> The following, while not recommended methods for generating DataFrames
> 
> 
> 

So, is there a more "best practice" way (besides append/concat) to add the rows with the values?