I am trying to add a single value to a row of a dataframe each time a for loop goes by. What I did was:
df1= pd.read_csv('data1.csv')
df2= pd.read_csv('data2.csv')
df3 = pd.DataFrame()
for i in df1.index:
for j in df2.index:
some_name = df1['some name'].iloc[j]
other_name = df2['other name'].iloc[i]
range = j
df3 = df3.set_value(i, some_name, range)
df3 = df3.set_value(i, 'Cargo', other_name)
What I ment to do is this:
But what I am getting is that in the first iteration the values are right but when I get to the second iteration my df3
becomes empty.
UPDATE
My df1 column, which is the only one in this table that I am using, would be like:
And my df2 column, which is the only one in this table that I am using, would be like: