title: ValueError: scatter requires x column to be numeric
body: <p>I have a df as follows:</p>
  
  <pre><code>EscRF_P2P_Volt_V    ContextID   StepID  Time_Elapsed    iso_forest
  12.4542121887207    7289972 15  32.472  1
  27.1062278747559    7289972 15  33.444  1
  622.710632324219    7289972 19  37.503  -1
  622.710632324219    7289972 19  38.513000000000005  -1
  622.710632324219    7289972 19  39.503  -1
  622.710632324219    7289972 19  40.503  -1
  622.710632324219    7289972 19  41.503  -1
  622.710632324219    7289972 19  42.503  -1
  622.710632324219    7289972 19  43.503  -1
  622.710632324219    7289972 19  44.503  -1
  622.710632324219    7289972 19  45.532000000000004  -1
  622.710632324219    7289972 19  46.502  -1
  622.710632324219    7289972 19  47.501000000000005  -1
  622.710632324219    7289972 19  48.501000000000005  -1
  622.710632324219    7289972 19  49.501000000000005  -1
  622.710632324219    7289972 19  50.501000000000005  -1
  622.710632324219    7289972 19  51.501000000000005  -1
  622.710632324219    7289972 19  52.501000000000005  -1
  622.710632324219    7289972 19  53.502  -1
  23.4432239532471    7289973 24  102.49000000000001  1
  23.4432239532471    7289973 24  104.078 1
  22.7106227874756    7289973 24  104.92800000000001  1
  23.4432239532471    7289973 24  105.81800000000001  1
  23.4432239532471    7289973 24  106.918 1
  22.7106227874756    7289973 24  107.61000000000001  1
  23.4432239532471    7289973 24  108.65  1
  23.4432239532471    7289973 24  108.73100000000001  1
  23.4432239532471    7289973 24  109.19800000000001  1
  23.4432239532471    7289973 24  110.12  1
  23.4432239532471    7289973 24  111.11000000000001  1
  23.4432239532471    7289973 24  112.108 1
  22.7106227874756    7289973 24  113.11000000000001  1
  21.97802162170409   7289973 24  114.11000000000001  -1
  22.7106227874756    7289973 24  115.11000000000001  1
  23.4432239532471    7289973 24  116.11000000000001  1
  22.7106227874756    7289973 24  117.18  1
  23.4432239532471    7289973 24  118.13000000000001  1
  23.4432239532471    7289973 24  119.13000000000001  1
  </code></pre>
  
  <p>The <code>ContextID</code> is a product and I have 1400 different ContextIDs meaning that I have 1400 different products. I am trying to overlap and plot 200 different ContextIDs at once in one window, the next 200 in the second window and so on. In the end, I get 7 windows for 1400 products. For achieving the same, I wrote the following code:</p>
  
  <pre><code>from itertools import zip_longest
  
  def grouper(iterable, n, fillvalue = None):
      #Collect data into fixed-length chunks or blocks
      #grouper('ABCDEFG', 3, 'x') --&gt; ABC DEF Gxx"
      args = [iter(iterable)] * n
      return zip_longest(*args, fillvalue=fillvalue)
  
  def add_to_axes(ax, data, param, context_id = None):
      data.plot(x = "Time_Elapsed", y = param, label = context_id, ax = ax)
      outlier = data["iso_forest"] == -1
      data[~outlier].plot.scatter(x = "Time_Elapsed", y = param, color = "green", ax = ax)
      data[outlier].plot.scatter(x = "Time_Elapsed", y = param, color = "red", ax = ax)
  
  def group_plots(df, param, group_size = 200):
      for group in grouper(df.groupby("ContextID"), n = group_size):
          fig, ax = plt.subplots()
          for context_id, data in filter(None, group):
              add_to_axes(ax, data, param, context_id)
              ax.legend().set_visible(False)
          yield fig
  </code></pre>
  
  <p>and when I do</p>
  
  <pre><code>Epvv['plot_data'] = Epvv['merged_df']
  for i, fig in enumerate(group_plots(Epvv['plot_data'], 'EscRF_P2P_Volt_V')):
      show()
  </code></pre>
  
  <p>for the above df, it gives me the following error:</p>
  
  <pre><code>    for i, fig in enumerate(group_plots(Epvv['plot_data'], 'EscRF_P2P_Volt_V')):
      show()
  Traceback (most recent call last):
  
    File "&lt;ipython-input-10-cdcfbb39cc21&gt;", line 1, in &lt;module&gt;
      for i, fig in enumerate(group_plots(Epvv['plot_data'], 'EscRF_P2P_Volt_V')):
  
    File "&lt;ipython-input-1-b8732ccafe84&gt;", line 46, in group_plots
      add_to_axes(ax, data, param, context_id)
  
    File "&lt;ipython-input-1-b8732ccafe84&gt;", line 39, in add_to_axes
      data[outlier].plot.scatter(x = "Time_Elapsed", y = param, color = "red", ax = ax)
  
    File "C:\Users\kashy\Anaconda3\envs\py36\lib\site-packages\pandas\plotting\_core.py", line 3516, in scatter
      return self(kind='scatter', x=x, y=y, c=c, s=s, **kwds)
  
    File "C:\Users\kashy\Anaconda3\envs\py36\lib\site-packages\pandas\plotting\_core.py", line 2942, in __call__
      sort_columns=sort_columns, **kwds)
  
    File "C:\Users\kashy\Anaconda3\envs\py36\lib\site-packages\pandas\plotting\_core.py", line 1973, in plot_frame
      **kwds)
  
    File "C:\Users\kashy\Anaconda3\envs\py36\lib\site-packages\pandas\plotting\_core.py", line 1740, in _plot
      kind=kind, **kwds)
  
    File "C:\Users\kashy\Anaconda3\envs\py36\lib\site-packages\pandas\plotting\_core.py", line 860, in __init__
      super(ScatterPlot, self).__init__(data, x, y, s=s, **kwargs)
  
    File "C:\Users\kashy\Anaconda3\envs\py36\lib\site-packages\pandas\plotting\_core.py", line 804, in __init__
      raise ValueError(self._kind + ' requires x column to be numeric')
  
  ValueError: scatter requires x column to be numeric
  </code></pre>
  
  <p>But, when I apply the same to a second df</p>
  
  <pre><code>BacksGas_Flow_sccm  ContextID   StepID  Time_Elapsed    iso_forest
  1.953125    7289972 1   0.0 1
  1.953125    7289972 1   0.055   1
  2.05078125  7289972 2   0.156   -1
  2.05078125  7289972 2   0.48700000000000004 -1
  2.05078125  7289972 2   1.477   -1
  1.953125    7289972 2   2.4770000000000003  1
  1.7578125   7289972 2   3.4770000000000003  1
  1.7578125   7289972 2   4.487   1
  1.85546875  7289972 2   5.993   1
  1.7578125   7289972 2   6.545000000000001   1
  9.08203125  7289972 5   7.9830000000000005  -1
  46.6796875  7289972 5   13.093  1
  46.6796875  7289972 5   13.384  1
  46.6796875  7289972 5   14.388000000000002  1
  46.6796875  7289972 5   15.386000000000001  1
  46.6796875  7289972 5   16.386000000000003  1
  46.6796875  7289972 5   17.396  1
  46.6796875  7289972 5   18.406000000000002  1
  46.6796875  7289972 5   19.396  1
  74.12109375 7289973 19  98.89800000000001   1
  74.12109375 7289973 19  99.59800000000001   1
  74.12109375 7289973 19  100.488 1
  74.90234375 7289973 19  101.798 1
  6.4453125   7289973 24  102.49000000000001  -1
  3.515625    7289973 24  104.078 -1
  2.5390625   7289973 24  104.92800000000001  -1
  2.05078125  7289973 24  105.81800000000001  1
  2.05078125  7289973 24  106.918 1
  2.05078125  7289973 24  107.61000000000001  1
  1.953125    7289973 24  108.65  1
  </code></pre>
  
  <p>and do</p>
  
  <pre><code>Bgf['plot_data'] = Bgf['merged_df']
  for i, fig in enumerate(group_plots(Bgf['plot_data'], 'BacksGas_Flow_sccm')):
      show()
  </code></pre>
  
  <p>it works perfectly fine without any errors an gives me 7 different windows, each having a time plot of 200 different products.</p>
  
  <p>I also checked the datatype of both the dataframes and they were the same:</p>
  
  <pre><code>print(Bgf['plot_data'].dtypes)
  BacksGas_Flow_sccm    float64
  ContextID              object
  StepID                 object
  Time_Elapsed          float64
  iso_forest             object
  dtype: object
  
  print(Epvv['plot_data'].dtypes)
  EscRF_P2P_Volt_V    float64
  ContextID            object
  StepID               object
  Time_Elapsed        float64
  iso_forest           object
  dtype: object
  </code></pre>
  
  <p>I don't understand what is the mistake I am doing here, since the code is working for one df and not working for the other. Any help would be appreciated.</p>
  
  <p>Thanks</p>