Closed
Description
Hello all,
I want collect few tables into the one with pandas. I use the code presented below:
import pandas as pd
import itertools
import types
df = None
for frame in ['x', 'y']:
df_ = pd.read_excel(u'%s.xlsx' % frame)
df_ = df_.set_index([u'time'])
parameters = list(df_.columns)
tuples = []
for tup in itertools.product([frame,], parameters):
tuples.append(tup)
columns = pd.MultiIndex.from_tuples(tuples, names=[u'Frames',u'Parameters'])
df_new = pd.DataFrame(columns=columns, index=df_.index)
for par in parameters:
df_new[frame, par] = df_[par]
del df_
if df is None:
df = df_new
else:
df = pd.concat([df, df_new], axis=1)
df.to_excel('merged_xlsx.xlsx')
df.to_excel('merged_xls.xls')
XLS engine works well (merged_xls.xls
):
But something is wrong (cells merging) with XLSX engine (merged_xlsx.xlsx
):
Manual cells unmerging works in Excel:
Is it bug in XLSX pandas engine (openpyxl)? Or what is wrong in my code?
Versions: python-2.7.10
, pandas-0.17.0
, openpyxl-2.3.0
.
P.S. This issue is copy of my question on stackoverflow. It was suggested as bug and was adviced to post here.