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...
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:
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
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.