I want to perform an append operation between two dataframes with a "For" loop, but this method does not work!
df1 = pd.DataFrame(
{
"A": ["A0", "A1", "A2", "A3"],
"B": ["B0", "B1", "B2", "B3"],
"C": ["C0", "C1", "C2", "C3"],
"D": ["D0", "D1", "D2", "D3"],
},
index=[0, 1, 2, 3],
)
df2 = pd.DataFrame()
for i in range(len(df1)):
df2.append(df1.iloc[i])
error:
AttributeError: 'DataFrame' object has no attribute 'append'
This method works well on lists
How can I use this method for pandas?
I want every row that was approved by me to be added to the empty list of the df2 dataframe.