2016-04-13

How to enable MS Excel support in pandas

First, install dependencies from command line. For Python3 you use pip3, for Python2 you use pip. I have used --user flag to install the packages in my home directory.

pip3 install --user openpyxl
pip3 install --user xlrd
pip3 install --user xlwt

Now you should be able to read and write MS Excel files using pandas. In Python:

import pandas as pd
from pandas import DataFrame, Series
writer = pd.ExcelWriter('output.xlsx')
df1 = DataFrame(columns=['h','X','X model'])
df1.to_excel(writer,"Sheet 1")
writer.save()