我正在尝试,但df返回空白 文本框的值是列表形式的(54.0、60.18、86.758、73.71) 想象一下,csv文件的头是x y h w,文本框值将被附加到其中
import pandas
list111 = [(72.0, 578.18, 378.0, 591.71),(54.0, 564.18, 378.0, 577.71),(54.0, 550.18, 378.0, 563.71),(54.0, 536.18, 378.0, 549.71)]
df = pd.DataFrame()
print df
list_title = ["x","y","h","w"]
for textbox in list111:
zipped=zip(list_title,textbox)
df1 = pd.DataFrame(zipped)
df.append(df1,ignore_index=True)
print df1,df
你差点就搞定了。只要改变你构造数据帧的方式
印刷品:
^{pr2}$您需要将} 与参数
DataFrames
追加到列表dfs
中,然后将^{axis=1
一起使用:如果需要一个公共列作为
^{pr2}$index
:但我认为最好是使用} :
DataFrame
构造函数和^{相关问题 更多 >
编程相关推荐