title: TypeError 'buffer size mismatch' error when defining a series in xlsxwriter
body: <p>I am trying to programmatically create a chart in an xlsx file using xlsxwriter and pandas data.
  Writing cells is succeeding fine, however when I try to define a Data Series for a Scatter chart I get a TypeError 'buffer size mismatch' and I'm fairly certain my defined range is acceptable.</p>
  
  <p>Example code:</p>
  
  <pre><code>headers = DataFrame([[-0.398,2],[-0.201,2],[-0.001,20]],columns=['Bias','Sensitivity'])
  dfs = [DataFrame([[3998.28253,2.056],[3997.31816,1.978],[3996.35379,1.932],[3995.38942,1.746],[3994.42504,1.478]]),
         DataFrame([[3998.28253,2.056],[3997.31816,1.978],[3996.35379,1.932],[3995.38942,1.746],[3994.42504,1.478]]),
         DataFrame([[3998.28253,2.056],[3997.31816,1.978],[3996.35379,1.932],[3995.38942,1.746],[3994.42504,1.478]])]
         # Repeated DataFrames here for convenience
  
  outxls = os.path.join(os.path.dirname(toplevelname),p+'.xlsx')
  
  workbook = xlsxwriter.Workbook(outxls)
  worksheet = workbook.add_worksheet('Sheet1')
  
  worksheet.write(0, 0, 'Bias')
  worksheet.write(1, 0, 'Sensitivity')
  
  chart = workbook.add_chart({'type': 'scatter'})
  for i, h in enumerate(headers.index):
      worksheet.write_number(0, 2*i+2, headers['Bias'][h], )
      worksheet.write_number(1, 2*i+2, headers['Sensitivity'][h])
      for r, row in dfs[h].iterrows():
          for c, col in enumerate(row):
              worksheet.write_number(r+2, 2*i+c+1, row[c])
  
      l = len(dfs[h])
      chart.add_series({
              'name': headers['Bias'][h],
              'categories': ['Sheet1', 3, 1, l, 1],
              'values': ['Sheet1', 3, 2, l, 2],
          })
  worksheet.insert_chart('B3', chart)
  
  workbook.close()
  </code></pre>
  
  <p>Full Error Message:</p>
  
  <pre><code>---------------------------------------------------------------------------
  TypeError                                 Traceback (most recent call last)
  &lt;ipython-input-5-56283fee8773&gt; in &lt;module&gt;()
       52                 'name': headers['Bias'][h],
       53                 'categories': ['Sheet1', 3, 1, l, 1],
  ---&gt; 54                 'values': ['Sheet1', 3, 2, l, 2],
       55             })
       56     worksheet.insert_chart('B3', chart)
  
  /Users/megablanc/Library/Python/2.7/lib/python/site-packages/xlsxwriter/chart.pyc in add_series(self, options)
      134         # Switch name and name_formula parameters if required.
      135         name, name_formula = self._process_names(options.get('name'),
  --&gt; 136                                                  options.get('name_formula'))
      137 
      138         # Get an id for the data equivalent to the range formula.
  
  /Users/megablanc/Library/Python/2.7/lib/python/site-packages/xlsxwriter/chart.pyc in _process_names(self, name, name_formula)
      788                 name_formula = quote_sheetname(name[0]) + '!' + cell
      789                 name = ''
  --&gt; 790             elif re.match(r'^=?[^!]+!\$?[A-Z]+\$?[0-9]+', name):
      791                 # Name looks like a formula, use it to set name_formula.
      792                 name_formula = name
  
  /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/re.pyc in match(pattern, string, flags)
      135     """Try to apply the pattern at the start of the string, returning
      136     a match object, or None if no match was found."""
  --&gt; 137     return _compile(pattern, flags).match(string)
      138 
      139 def search(pattern, string, flags=0):
  
  TypeError: buffer size mismatch
  </code></pre>