Click here to Skip to main content
14,923,034 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Everyone,

Being as a newbie in Python, while I tried to run some sample code of pandas and Matplotlib libraries, I got errors which I don't understand how to resolve.

Here is the first sample code...

Python
import pandas

writer = pandas.ExcelWriter('farm_data.xlsx', engine='xlsxwriter')
pandas.to_excel(writer, sheet_name='Sheet1')

workbook = writer.book
worksheet = writer.sheets['Sheet1']

chart = workbook.add_chart({'type': 'column'})


For this piece of snippet, I got:
Python
AttributeError: module 'pandas' has no attribute 'to_excel'


Apart from this, I tried to run another sample code
Example: Line Chart — XlsxWriter Charts[^]
and I got this
Python
ModuleNotFoundError: No module named 'matplotlib.pyplot'; 'matplotlib' is not a package


I already have the modules (matplotlib, pandas) using pip command.

Any idea like how to avoid such kind of errors in future or how to debug these errors to save valuable time would be really appreciable

What I have tried:

Tried:

import matplotlib and pandas in shell, no error found.
I tried to find out the similar question on web, got some questions way different from this problem.
Posted
Updated 25-Aug-17 22:22pm

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900