I want to make a data frame that looks like the top one like the bottom one. What should I do now?
https://kin.naver.com/qna/detail.naver?d1id=1&dirId=104&docId=429520356
I'm sharing the link that I attached because the image didn't go up<
python pandas numpy
df = pd.DataFrame({'a':[1,2,3],
'b':[1,2,3],
'c':[1,2,3],
'd':[1,2,3]})
res = pd.DataFrame()
for i in range(len(df)):
res = pd.concat([res, df.iloc[[i]]])
res = pd.concat([res, df.iloc[[i]]])
print(res)
How about this?
© 2024 OneMinuteCode. All rights reserved.