赞
踩
#建空表
df1=pd.Dataframe(columns=['col1','col2','col3'])
Pandas/numpy structures are fundamentally not suited for efficiently growing. 但真的想要扩展的话,可以试试是如下方法
a = {"col1":1,"col2":2}#col3会自动留空
df1=df1.append(a,ignore_index=True))
df.loc[df.shape[0]] = dict(zip(df.columns, value))
rows_list = np.array(df).tolist()
for row in data: rows_list.append(row )
df = pd.DataFrame(rows_list)
参考:https://www.zhihu.com/question/36170252
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。