我有数据帧df1和df2都有列[“Ticker”,“Adj.Factor”,“Date”]。如果df1中该行中“Adj.Factor”的值等于0,我想从df1向df2添加完整行。
我有以下代码。
for x in range(tot_len):
if df1.iloc[x]['Adj.Factor'] == 0:
df2.append(df1.iloc[x]) --> not working.
`
我尝试打印值,它显示正确的输出。但这些值不会附加到df2。
看来你错过了一项任务。这是一个更简单的解决方案
df2 = df2.append(df1[df1['Adj.Factor'] == 0])