I am trying to use a for loop to add series for a chart in a xlsx file but I am getting a strange error.

Here's is my code.

This portion shows that I have sorted my DF and reindexed it for ease of interpreting the DF index to excel index for excel cell reference.

```
# Sort dataframe and reindex
pivDF = pivDF.sort_values(by=['Vg'])
pivDF = pivDF.reset_index(drop=True) # reindex dropping previous index instead of adding it as a new column

# Add the following as a sheet in a excel file:
# data, chart
## Create workbook
workbook = xlsxwriter.Workbook(dirPath + file_name + '.xlsx') # Creates workbook object
## Add a worksheet to hold the data.
writer = pd.ExcelWriter(dirPath+"//"+file_name+".xlsx", engine = 'xlsxwriter')
pivDF.to_excel(writer,sheet_name = 'Data')
writer.save()
## Add plot 
### Create a new line chart.
chartsheet = workbook.add_chartsheet() # creates chartsheet objec
chart = workbook.add_chart({'type': 'line'}) # creates chart object

```

The following adds the series and is where I am encountering the issue.

```
### Configure the chart
#### Configure series.
##### Get unique Vg
Vglist = pivDF.Vg.unique()
C1 = 'D'
C2 = 'F'
for Vg in Vglist:
    # Get min and max row excel index for current Vg
    indexList = list(pivDF.loc[(pivDF.Vg == Vglist[0])].index.values) # gets list of index at Vg value
    r1 = min(indexList) + 2
    r2 = max(indexList) + 2
    chart.add_series({
        'name':       'Vg ' + Vg + 'V',
        'categories': '=Sheet1!$'+ C1 +'$'+ r1 +':$'+ C1 +'$'+ r2, # Vd data
        'values':     '=Sheet1!$'+ C2 +'$'+ r1 +':$'+ C2 +'$'+ r2, # Id normalized data
    })

```

Thank you in advance!