【发布时间】:2019-10-25 17:03:00
【问题描述】:
我想将特定列向下移动一个(我不知道其他库是否可以帮助我)
import pandas as pd
#pd.set_option('display.max_rows',100)
fac=pd.read_excel('TEST.xlsm',sheet_name="DC - Consumables",header=None, skiprows=1)
df = pd.DataFrame(fac)
df1=df.iloc[0:864,20:39]
df2=df.iloc[0:864,40:59]
df1=pd.concat([df1,df2])
print (df1)
我希望一列低于另一列
A B C` A B C`
1 2 3` 6 7 8`
4 5 8` 4 1 9`
我的代码打印这个
A B C
1 2 3
4 5 8
A B C
6 7 8
4 1 9
我需要第二列(数据框)位于第一列下方,如下所示:
A B C
1 2 3
4 5 8
A B C
6 7 8
4 1 9
请帮帮我
【问题讨论】:
-
Please don't post images of code/data (or links to them) 而是将数据作为文本发布,以便我们可以使用
pd.read_clipboard()阅读:另外请稍微解释一下这个问题。您可能想花时间阅读how to provide a great pandas example上的这篇文章
标签: python excel pandas dataframe