I'm trying to export data from Python using (http://jupyter.org/) to Excel
import pandas as pd
import matplotlib.pyplot as plt
from datetime import datetime
df = pd.read_csv('rr.csv')
df['COLLISION_DATE'] = pd.to_datetime(df['COLLISION_DATE'],format='%Y%m%d')
df['week'], df['month'], df['year'],df['day'] = df['COLLISION_DATE'].dt.week, df['COLLISION_DATE'].dt.month, df['COLLISION_DATE'].dt.year,df['COLLISION_DATE'].dt.day
df = df.groupby('month').size().to_frame('Number of Accidents')
df.plot.line()
plt.show()
df
df.to_excel('m.xlsx')
I'm getting error
ModuleNotFoundError: `No module named 'openpyxl'
this is my first project using Python Any Idea whats wrong or any other code that I can Use ?

pip install openpyxl, it's not provided by defaultopenpyxlmodule available. So you'll need to have the Python modules on your own computer. Download and install for example the Anaconda distribution. It has a user-friendly installer, and it already includes theopenpyxl,jupyter,pandasandmatplotlibmodules right away.