In [4]:
# load seaborn and other stuff for visualization
import seaborn  # pip install --user seaborn
from matplotlib import pyplot as plt
%matplotlib inline

In [7]:
import pandas as pd
from IPython.display import display

In [20]:
"""
1% of abs(predicted_ping - ping)/ping values are lesser or equal than 0.0
5% of abs(predicted_ping - ping)/ping values are lesser or equal than 0.0002597402597402265
15% of abs(predicted_ping - ping)/ping values are lesser or equal than 0.0029556650246304376
30% of abs(predicted_ping - ping)/ping values are lesser or equal than 0.012106898165879409
50% of abs(predicted_ping - ping)/ping values are lesser or equal than 0.037836240023647605
80% of abs(predicted_ping - ping)/ping values are lesser or equal than 0.1275367062564295
90% of abs(predicted_ping - ping)/ping values are lesser or equal than 0.16165919282511212
95% of abs(predicted_ping - ping)/ping values are lesser or equal than 0.1905417814508723
99% of abs(predicted_ping - ping)/ping values are lesser or equal than 0.2857142857142857
"""

quantiles = pd.DataFrame(
    columns=["quantile", "relative_error"],
    data=[[0.01, 0.0],
          [0.05, 0.0002597402597402265],
          [0.15, 0.0029556650246304376],
          [0.3, 0.012106898165879409],
          [0.5, 0.037836240023647605],
          [0.8, 0.1275367062564295],
          [0.9, 0.16165919282511212],
          [0.95, 0.1905417814508723],
          [0.99, 0.2857142857142857]]
).set_index("quantile")

In [21]:
quantiles


Out[21]:
relative_error
quantile
0.01 0.000000
0.05 0.000260
0.15 0.002956
0.30 0.012107
0.50 0.037836
0.80 0.127537
0.90 0.161659
0.95 0.190542
0.99 0.285714

In [15]:
help(quantiles.plot)


Help on FramePlotMethods in module pandas.tools.plotting object:

class FramePlotMethods(BasePlotMethods)
 |  DataFrame plotting accessor and method
 |  
 |  Examples
 |  --------
 |  >>> df.plot.line()
 |  >>> df.plot.scatter('x', 'y')
 |  >>> df.plot.hexbin()
 |  
 |  These plotting methods can also be accessed by calling the accessor as a
 |  method with the ``kind`` argument:
 |  ``df.plot(kind='line')`` is equivalent to ``df.plot.line()``
 |  
 |  Method resolution order:
 |      FramePlotMethods
 |      BasePlotMethods
 |      pandas.core.base.PandasObject
 |      pandas.core.base.StringMixin
 |      builtins.object
 |  
 |  Methods defined here:
 |  
 |  __call__(self, x=None, y=None, kind='line', ax=None, subplots=False, sharex=None, sharey=False, layout=None, figsize=None, use_index=True, title=None, grid=None, legend=True, style=None, logx=False, logy=False, loglog=False, xticks=None, yticks=None, xlim=None, ylim=None, rot=None, fontsize=None, colormap=None, table=False, yerr=None, xerr=None, secondary_y=False, sort_columns=False, **kwds)
 |      Make plots of DataFrame using matplotlib / pylab.
 |      
 |      *New in version 0.17.0:* Each plot kind has a corresponding method on the
 |      ``DataFrame.plot`` accessor:
 |      ``df.plot(kind='line')`` is equivalent to
 |      ``df.plot.line()``.
 |      
 |      Parameters
 |      ----------
 |      data : DataFrame
 |      x : label or position, default None
 |      y : label or position, default None
 |          Allows plotting of one column versus another
 |      kind : str
 |          - 'line' : line plot (default)
 |          - 'bar' : vertical bar plot
 |          - 'barh' : horizontal bar plot
 |          - 'hist' : histogram
 |          - 'box' : boxplot
 |          - 'kde' : Kernel Density Estimation plot
 |          - 'density' : same as 'kde'
 |          - 'area' : area plot
 |          - 'pie' : pie plot
 |          - 'scatter' : scatter plot
 |          - 'hexbin' : hexbin plot
 |      ax : matplotlib axes object, default None
 |      subplots : boolean, default False
 |          Make separate subplots for each column
 |      sharex : boolean, default True if ax is None else False
 |          In case subplots=True, share x axis and set some x axis labels to
 |          invisible; defaults to True if ax is None otherwise False if an ax
 |          is passed in; Be aware, that passing in both an ax and sharex=True
 |          will alter all x axis labels for all axis in a figure!
 |      sharey : boolean, default False
 |          In case subplots=True, share y axis and set some y axis labels to
 |          invisible
 |      layout : tuple (optional)
 |          (rows, columns) for the layout of subplots
 |      figsize : a tuple (width, height) in inches
 |      use_index : boolean, default True
 |          Use index as ticks for x axis
 |      title : string
 |          Title to use for the plot
 |      grid : boolean, default None (matlab style default)
 |          Axis grid lines
 |      legend : False/True/'reverse'
 |          Place legend on axis subplots
 |      style : list or dict
 |          matplotlib line style per column
 |      logx : boolean, default False
 |          Use log scaling on x axis
 |      logy : boolean, default False
 |          Use log scaling on y axis
 |      loglog : boolean, default False
 |          Use log scaling on both x and y axes
 |      xticks : sequence
 |          Values to use for the xticks
 |      yticks : sequence
 |          Values to use for the yticks
 |      xlim : 2-tuple/list
 |      ylim : 2-tuple/list
 |      rot : int, default None
 |          Rotation for ticks (xticks for vertical, yticks for horizontal plots)
 |      fontsize : int, default None
 |          Font size for xticks and yticks
 |      colormap : str or matplotlib colormap object, default None
 |          Colormap to select colors from. If string, load colormap with that name
 |          from matplotlib.
 |      colorbar : boolean, optional
 |          If True, plot colorbar (only relevant for 'scatter' and 'hexbin' plots)
 |      position : float
 |          Specify relative alignments for bar plot layout.
 |          From 0 (left/bottom-end) to 1 (right/top-end). Default is 0.5 (center)
 |      layout : tuple (optional)
 |          (rows, columns) for the layout of the plot
 |      table : boolean, Series or DataFrame, default False
 |          If True, draw a table using the data in the DataFrame and the data will
 |          be transposed to meet matplotlib's default layout.
 |          If a Series or DataFrame is passed, use passed data to draw a table.
 |      yerr : DataFrame, Series, array-like, dict and str
 |          See :ref:`Plotting with Error Bars <visualization.errorbars>` for
 |          detail.
 |      xerr : same types as yerr.
 |      stacked : boolean, default False in line and
 |          bar plots, and True in area plot. If True, create stacked plot.
 |      sort_columns : boolean, default False
 |          Sort column names to determine plot ordering
 |      secondary_y : boolean or sequence, default False
 |          Whether to plot on the secondary y-axis
 |          If a list/tuple, which columns to plot on secondary y-axis
 |      mark_right : boolean, default True
 |          When using a secondary_y axis, automatically mark the column
 |          labels with "(right)" in the legend
 |      kwds : keywords
 |          Options to pass to matplotlib plotting method
 |      
 |      Returns
 |      -------
 |      axes : matplotlib.AxesSubplot or np.array of them
 |      
 |      Notes
 |      -----
 |      
 |      - See matplotlib documentation online for more on this subject
 |      - If `kind` = 'bar' or 'barh', you can specify relative alignments
 |        for bar plot layout by `position` keyword.
 |        From 0 (left/bottom-end) to 1 (right/top-end). Default is 0.5 (center)
 |      - If `kind` = 'scatter' and the argument `c` is the name of a dataframe
 |        column, the values of that column are used to color each point.
 |      - If `kind` = 'hexbin', you can control the size of the bins with the
 |        `gridsize` argument. By default, a histogram of the counts around each
 |        `(x, y)` point is computed. You can specify alternative aggregations
 |        by passing values to the `C` and `reduce_C_function` arguments.
 |        `C` specifies the value at each `(x, y)` point and `reduce_C_function`
 |        is a function of one argument that reduces all the values in a bin to
 |        a single number (e.g. `mean`, `max`, `sum`, `std`).
 |  
 |  area(self, x=None, y=None, **kwds)
 |      Area plot
 |      
 |      .. versionadded:: 0.17.0
 |      
 |      Parameters
 |      ----------
 |      x, y : label or position, optional
 |          Coordinates for each point.
 |      **kwds : optional
 |          Keyword arguments to pass on to :py:meth:`pandas.DataFrame.plot`.
 |      
 |      Returns
 |      -------
 |      axes : matplotlib.AxesSubplot or np.array of them
 |  
 |  bar(self, x=None, y=None, **kwds)
 |      Vertical bar plot
 |      
 |      .. versionadded:: 0.17.0
 |      
 |      Parameters
 |      ----------
 |      x, y : label or position, optional
 |          Coordinates for each point.
 |      **kwds : optional
 |          Keyword arguments to pass on to :py:meth:`pandas.DataFrame.plot`.
 |      
 |      Returns
 |      -------
 |      axes : matplotlib.AxesSubplot or np.array of them
 |  
 |  barh(self, x=None, y=None, **kwds)
 |      Horizontal bar plot
 |      
 |      .. versionadded:: 0.17.0
 |      
 |      Parameters
 |      ----------
 |      x, y : label or position, optional
 |          Coordinates for each point.
 |      **kwds : optional
 |          Keyword arguments to pass on to :py:meth:`pandas.DataFrame.plot`.
 |      
 |      Returns
 |      -------
 |      axes : matplotlib.AxesSubplot or np.array of them
 |  
 |  box(self, by=None, **kwds)
 |      Boxplot
 |      
 |      .. versionadded:: 0.17.0
 |      
 |      Parameters
 |      ----------
 |      by : string or sequence
 |          Column in the DataFrame to group by.
 |      \*\*kwds : optional
 |          Keyword arguments to pass on to :py:meth:`pandas.DataFrame.plot`.
 |      
 |      Returns
 |      -------
 |      axes : matplotlib.AxesSubplot or np.array of them
 |  
 |  density = kde(self, **kwds)
 |  
 |  hexbin(self, x, y, C=None, reduce_C_function=None, gridsize=None, **kwds)
 |      Hexbin plot
 |      
 |      .. versionadded:: 0.17.0
 |      
 |      Parameters
 |      ----------
 |      x, y : label or position, optional
 |          Coordinates for each point.
 |      C : label or position, optional
 |          The value at each `(x, y)` point.
 |      reduce_C_function : callable, optional
 |          Function of one argument that reduces all the values in a bin to
 |          a single number (e.g. `mean`, `max`, `sum`, `std`).
 |      gridsize : int, optional
 |          Number of bins.
 |      **kwds : optional
 |          Keyword arguments to pass on to :py:meth:`pandas.DataFrame.plot`.
 |      
 |      Returns
 |      -------
 |      axes : matplotlib.AxesSubplot or np.array of them
 |  
 |  hist(self, by=None, bins=10, **kwds)
 |      Histogram
 |      
 |      .. versionadded:: 0.17.0
 |      
 |      Parameters
 |      ----------
 |      by : string or sequence
 |          Column in the DataFrame to group by.
 |      bins: integer, default 10
 |          Number of histogram bins to be used
 |      **kwds : optional
 |          Keyword arguments to pass on to :py:meth:`pandas.DataFrame.plot`.
 |      
 |      Returns
 |      -------
 |      axes : matplotlib.AxesSubplot or np.array of them
 |  
 |  kde(self, **kwds)
 |      Kernel Density Estimate plot
 |      
 |      .. versionadded:: 0.17.0
 |      
 |      Parameters
 |      ----------
 |      **kwds : optional
 |          Keyword arguments to pass on to :py:meth:`pandas.DataFrame.plot`.
 |      
 |      Returns
 |      -------
 |      axes : matplotlib.AxesSubplot or np.array of them
 |  
 |  line(self, x=None, y=None, **kwds)
 |      Line plot
 |      
 |      .. versionadded:: 0.17.0
 |      
 |      Parameters
 |      ----------
 |      x, y : label or position, optional
 |          Coordinates for each point.
 |      **kwds : optional
 |          Keyword arguments to pass on to :py:meth:`pandas.DataFrame.plot`.
 |      
 |      Returns
 |      -------
 |      axes : matplotlib.AxesSubplot or np.array of them
 |  
 |  pie(self, y=None, **kwds)
 |      Pie chart
 |      
 |      .. versionadded:: 0.17.0
 |      
 |      Parameters
 |      ----------
 |      y : label or position, optional
 |          Column to plot.
 |      **kwds : optional
 |          Keyword arguments to pass on to :py:meth:`pandas.DataFrame.plot`.
 |      
 |      Returns
 |      -------
 |      axes : matplotlib.AxesSubplot or np.array of them
 |  
 |  scatter(self, x, y, s=None, c=None, **kwds)
 |      Scatter plot
 |      
 |      .. versionadded:: 0.17.0
 |      
 |      Parameters
 |      ----------
 |      x, y : label or position, optional
 |          Coordinates for each point.
 |      s : scalar or array_like, optional
 |          Size of each point.
 |      c : label or position, optional
 |          Color of each point.
 |      **kwds : optional
 |          Keyword arguments to pass on to :py:meth:`pandas.DataFrame.plot`.
 |      
 |      Returns
 |      -------
 |      axes : matplotlib.AxesSubplot or np.array of them
 |  
 |  ----------------------------------------------------------------------
 |  Methods inherited from BasePlotMethods:
 |  
 |  __init__(self, data)
 |      Initialize self.  See help(type(self)) for accurate signature.
 |  
 |  ----------------------------------------------------------------------
 |  Methods inherited from pandas.core.base.PandasObject:
 |  
 |  __dir__(self)
 |      Provide method name lookup and completion
 |      Only provide 'public' methods
 |  
 |  __sizeof__(self)
 |      Generates the total memory usage for a object that returns
 |      either a value or Series of values
 |  
 |  __unicode__(self)
 |      Return a string representation for a particular object.
 |      
 |      Invoked by unicode(obj) in py2 only. Yields a Unicode String in both
 |      py2/py3.
 |  
 |  ----------------------------------------------------------------------
 |  Methods inherited from pandas.core.base.StringMixin:
 |  
 |  __bytes__(self)
 |      Return a string representation for a particular object.
 |      
 |      Invoked by bytes(obj) in py3 only.
 |      Yields a bytestring in both py2/py3.
 |  
 |  __repr__(self)
 |      Return a string representation for a particular object.
 |      
 |      Yields Bytestring in Py2, Unicode String in py3.
 |  
 |  __str__(self)
 |      Return a string representation for a particular Object
 |      
 |      Invoked by str(df) in both py2/py3.
 |      Yields Bytestring in Py2, Unicode String in py3.
 |  
 |  ----------------------------------------------------------------------
 |  Data descriptors inherited from pandas.core.base.StringMixin:
 |  
 |  __dict__
 |      dictionary for instance variables (if defined)
 |  
 |  __weakref__
 |      list of weak references to the object (if defined)


In [22]:
quantiles.plot.line(xlim=[0, 1], ylim=[0, 1])


Out[22]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fc7c85b7080>