So, my question may sound silly because this is the first time I'm using XlsxWriter. I straight up copied their code from their site but it didn't work.
The code is this:
import pandas as pd
# Create a Pandas dataframe from the data.
df = pd.DataFrame({'Data': [10, 20, 30, 20, 15, 30, 45]})
# Create a Pandas Excel writer using XlsxWriter as the engine.
writer = pd.ExcelWriter('pandas_simple.xlsx', engine='xlsxwriter')
# Convert the dataframe to an XlsxWriter Excel object.
df.to_excel(writer, sheet_name='Sheet1')
# Get the xlsxwriter objects from the dataframe writer object.
workbook = writer.book
worksheet = writer.sheets['Sheet1']
workbook = xlsxwriter.Workbook('filename.xlsx')
worksheet = workbook.add_worksheet()
Even before I could start dealing with CSV files, this basic first run failed, and the following error appeared:
NameError: name 'xlsxwriter' is not defined
I tried using pip install openpyxl as someone said in this previous thread, but it didn't work either. Can someone give me a hand here please?