The multiple copy and add the same dataframe objects in the original dataframe

df_2 = pd.DataFrame(np.arange(25).reshape(5,5))
for i in range(len(df_2)):
    a = df_2.loc[i]
    d = pd.DataFrame(a).T
    df_2 = df_2.append ([d] * 24) # copy each row 24 times
print(df_2)

  

Guess you like

Origin www.cnblogs.com/jdwfff/p/11990535.html