python在pandas.DataFrame添加一行

 代码示例:

from pandas import *
from random import *
df = DataFrame(columns=('lib', 'qty1', 'qty2'))#生成空的pandas表
for i in range(5):#插入一行
    df.loc[i] = [randint(-1,1) for n in range(3)]
print df


你可能感兴趣的:(Python)