python实现在pandas.DataFrame添加一行

实例如下所示:

from pandas import *
from random import *
df = DataFrame(columns=('lib', 'qty1', 'qty2'))#生成空的pandas表
for i in range(5):#插入一行<span id="transmark" style="display:none;"></span>
  df.loc[i] = [randint(-1,1) for n in range(3)]
print df

相关推荐