I was trying to generate Excel graphs with python from a dataframe and I found this code (code below):
So is not running, or opening Excel so I'm not sure if I install correctly pyxll in Conda, some help please or some easiest way to graph in excel with python
from pyxll import xl_func, plot
import pandas as pd
@xl_func
def pandas_plot():
# Create a DataFrame to plot
df = pd.DataFrame({
'name':['john','mary','peter','jeff','bill','lisa','jose'],
'age':[23,78,22,19,45,33,20],
'gender':['M','F','M','M','M','F','M'],
'state':['california','dc','california','dc','california','texas','texas'],
'num_children':[2,0,0,3,2,1,4],
'num_pets':[5,1,0,5,2,2,3]
})
# A simple bar chart, plotted using matplotlib.pyplot
df.plot(kind='bar',x='name',y='age')
# Show the current matplotlib.pyplot figure using pyxll.plot
plot()