I try to follow this link pandas dataframe with 2-rows header and export to csv in order for me to created extra header without remove the original header, below is my coding:
df.columns = pd.MultiIndex.from_tuples((zip(df.columns,[uniquevaluesfirstcolumnww, '', uniquevaluesfirstcolumnww1, ' ',uniquevaluesfirstcolumnww2, ' '])))
I get the error such as this: object of type 'zip' has no len()
Anyone have any idea? even though I try to add list before zip but fail also.
我认为问题在于
zip
返回object
,因此需要转换为list
:但似乎你需要^{} :
^{pr2}$如果列还有
MultiIndex
,则:相关问题 更多 >
编程相关推荐