0
它一直返回空数据帧。不太清楚为什么。我还在df_group
中将我的columns
命名为g_row
。我也试过pd.concate
。仍为空的数据帧无法使用追加将序列添加到数据帧
df_group = pd.DataFrame()
added = []
for i, g_row in df.iterrows():
if i not in added:
print g_row #not empty; type(g_row) Series
df_group.append(g_row, ignore_index=True)
added.append(i)
print df_group #empty
看起来像是想在'df'中删除重复的索引行?为什么不做'df [〜df.index.duplicated()]。reset_index(drop = True)'? – Zero
@zero是的,我在想,看起来效率很低,但我有一列改变 – JamAndJammies