我正在尝试合并两个数据框; “混洗” DF1,用于派生(预测的输出)DF2。我能够将它们合并在一起;但是,最终结果总是“不混洗” DF1与DF2合并。因此,DF3不匹配。
df1 = shuffle(pd.read_csv("C:/Users/.."))
filename = ('C:/Users/..')
loaded_model = pickle.load(open(filename, 'rb'))
df2 = loaded_model.predict(df1)
df3= pd.merge(df1, df2, left_index=True, right_index=True)
Here's an example the problem.:
df1 df1 (Shuffled)
0 3
1 2
2 1
3 0
df2
0
0
0
1
expected df3 = (shuffled df1) + df2:
df1 df2
3 0
2 0
1 0
0 1
however, im getting:
df1 df2
0 0
1 0
2 0
3 1
Thanks in advance for the time and effort!