class_docstr: Series/Frames plotting accessor and method.
  
  Uses the backend specified by the
  option ``plotting.backend``. By default, plotly is used.
  
  Plotting methods can also be accessed by calling the accessor as a method
  with the ``kind`` argument:
  ``s.plot(kind='hist')`` is equivalent to ``s.plot.hist()``
docstr: Vertical bar plot.
  
  Parameters
  ----------
  x : label or position, optional
      Allows plotting of one column versus another.
      If not specified, the index of the DataFrame is used.
  y : label or position, optional
      Allows plotting of one column versus another.
      If not specified, all numerical columns are used.
  **kwds : optional
      Additional keyword arguments are documented in
      :meth:`pyspark.pandas.Series.plot` or
      :meth:`pyspark.pandas.DataFrame.plot`.
  
  Returns
  -------
  :class:`plotly.graph_objs.Figure`
      Return an custom object when ``backend!=plotly``.
      Return an ndarray when ``subplots=True`` (matplotlib-only).
  
  Examples
  --------
  Basic plot.
  
  For Series:
  
  .. plotly::
  
      >>> s = ps.Series([1, 3, 2])
      >>> s.plot.bar()  # doctest: +SKIP
  
  For DataFrame:
  
  .. plotly::
  
      >>> df = ps.DataFrame({'lab': ['A', 'B', 'C'], 'val': [10, 30, 20]})
      >>> df.plot.bar(x='lab', y='val')  # doctest: +SKIP
  
  Plot a whole dataframe to a bar plot. Each column is stacked with a
  distinct color along the horizontal axis.
  
  .. plotly::
  
      >>> speed = [0.1, 17.5, 40, 48, 52, 69, 88]
      >>> lifespan = [2, 8, 70, 1.5, 25, 12, 28]
      >>> index = ['snail', 'pig', 'elephant',
      ...          'rabbit', 'giraffe', 'coyote', 'horse']
      >>> df = ps.DataFrame({'speed': speed,
      ...                    'lifespan': lifespan}, index=index)
      >>> df.plot.bar()  # doctest: +SKIP
  
  Instead of stacking, the figure can be split by column with plotly
  APIs.
  
  .. plotly::
  
      >>> from plotly.subplots import make_subplots
      >>> speed = [0.1, 17.5, 40, 48, 52, 69, 88]
      >>> lifespan = [2, 8, 70, 1.5, 25, 12, 28]
      >>> index = ['snail', 'pig', 'elephant',
      ...          'rabbit', 'giraffe', 'coyote', 'horse']
      >>> df = ps.DataFrame({'speed': speed,
      ...                    'lifespan': lifespan}, index=index)
      >>> fig = (make_subplots(rows=2, cols=1)
      ...        .add_trace(df.plot.bar(y='speed').data[0], row=1, col=1)
      ...        .add_trace(df.plot.bar(y='speed').data[0], row=1, col=1)
      ...        .add_trace(df.plot.bar(y='lifespan').data[0], row=2, col=1))
      >>> fig  # doctest: +SKIP
  
  Plot a single column.
  
  .. plotly::
  
      >>> speed = [0.1, 17.5, 40, 48, 52, 69, 88]
      >>> lifespan = [2, 8, 70, 1.5, 25, 12, 28]
      >>> index = ['snail', 'pig', 'elephant',
      ...          'rabbit', 'giraffe', 'coyote', 'horse']
      >>> df = ps.DataFrame({'speed': speed,
      ...                    'lifespan': lifespan}, index=index)
      >>> df.plot.bar(y='speed')  # doctest: +SKIP
  
  Plot only selected categories for the DataFrame.
  
  .. plotly::
  
      >>> speed = [0.1, 17.5, 40, 48, 52, 69, 88]
      >>> lifespan = [2, 8, 70, 1.5, 25, 12, 28]
      >>> index = ['snail', 'pig', 'elephant',
      ...          'rabbit', 'giraffe', 'coyote', 'horse']
      >>> df = ps.DataFrame({'speed': speed,
      ...                    'lifespan': lifespan}, index=index)
      >>> df.plot.bar(x='lifespan')  # doctest: +SKIP
docstr_tok: ["Vertical","bar","plot",".","Parameters","--","--","--","--","--","x",":","label","or","position",",","optional","Allows","plotting","of","one","column","versus","another",".","If","not","specified",",","the","index","of","the","DataFrame","is","used",".","y",":","label","or","position",",","optional","Allows","plotting","of","one","column","versus","another",".","If","not","specified",",","all","numerical","columns","are","used",".","*","*","kwds",":","optional","Additional","keyword","arguments","are","documented","in",":","meth",":","`","pyspark.pandas.Series.plot","`","or",":","meth",":","`","pyspark.pandas.DataFrame.plot","`",".","Returns","--","--","--","-",":","class",":","`","plotly.graph_objs.Figure","`","Return","an","custom","object","when","``","backend","!","=plotly","``",".","Return","an","ndarray","when","``","subplots=True","``","(","matplotlib-only",")",".","Examples","--","--","--","--","Basic","plot",".","For","Series",":","..","plotly",":",":",">",">",">","s","=","ps.Series","(","[","1",",","3",",","2","]",")",">",">",">","s.plot.bar","(",")","#","doctest",":","+SKIP","For","DataFrame",":","..","plotly",":",":",">",">",">","df","=","ps.DataFrame","(","{","'lab","'",":","[","'","A","'",",","'","B","'",",","'","C","'","]",",","'val","'",":","[","10",",","30",",","20","]","}",")",">",">",">","df.plot.bar","(","x='lab","'",",","y='val","'",")","#","doctest",":","+SKIP","Plot","a","whole","dataframe","to","a","bar","plot",".","Each","column","is","stacked","with","a","distinct","color","along","the","horizontal","axis",".","..","plotly",":",":",">",">",">","speed","=","[","0.1",",","17.5",",","40",",","48",",","52",",","69",",","88","]",">",">",">","lifespan","=","[","2",",","8",",","70",",","1.5",",","25",",","12",",","28","]",">",">",">","index","=","[","'snail","'",",","'pig","'",",","'elephant","'",",","...","'rabbit","'",",","'giraffe","'",",","'coyote","'",",","'horse","'","]",">",">",">","df","=","ps.DataFrame","(","{","'speed","'",":","speed",",","...","'lifespan","'",":","lifespan","}",",","index=index",")",">",">",">","df.plot.bar","(",")","#","doctest",":","+SKIP","Instead","of","stacking",",","the","figure","can","be","split","by","column","with","plotly","APIs",".","..","plotly",":",":",">",">",">","from","plotly.subplots","import","make_subplots",">",">",">","speed","=","[","0.1",",","17.5",",","40",",","48",",","52",",","69",",","88","]",">",">",">","lifespan","=","[","2",",","8",",","70",",","1.5",",","25",",","12",",","28","]",">",">",">","index","=","[","'snail","'",",","'pig","'",",","'elephant","'",",","...","'rabbit","'",",","'giraffe","'",",","'coyote","'",",","'horse","'","]",">",">",">","df","=","ps.DataFrame","(","{","'speed","'",":","speed",",","...","'lifespan","'",":","lifespan","}",",","index=index",")",">",">",">","fig","=","(","make_subplots","(","rows=2",",","cols=1",")","...",".add_trace","(","df.plot.bar","(","y='speed","'",")",".data","[","0","]",",","row=1",",","col=1",")","...",".add_trace","(","df.plot.bar","(","y='speed","'",")",".data","[","0","]",",","row=1",",","col=1",")","...",".add_trace","(","df.plot.bar","(","y='lifespan","'",")",".data","[","0","]",",","row=2",",","col=1",")",")",">",">",">","fig","#","doctest",":","+SKIP","Plot","a","single","column",".","..","plotly",":",":",">",">",">","speed","=","[","0.1",",","17.5",",","40",",","48",",","52",",","69",",","88","]",">",">",">","lifespan","=","[","2",",","8",",","70",",","1.5",",","25",",","12",",","28","]",">",">",">","index","=","[","'snail","'",",","'pig","'",",","'elephant","'",",","...","'rabbit","'",",","'giraffe","'",",","'coyote","'",",","'horse","'","]",">",">",">","df","=","ps.DataFrame","(","{","'speed","'",":","speed",",","...","'lifespan","'",":","lifespan","}",",","index=index",")",">",">",">","df.plot.bar","(","y='speed","'",")","#","doctest",":","+SKIP","Plot","only","selected","categories","for","the","DataFrame",".","..","plotly",":",":",">",">",">","speed","=","[","0.1",",","17.5",",","40",",","48",",","52",",","69",",","88","]",">",">",">","lifespan","=","[","2",",","8",",","70",",","1.5",",","25",",","12",",","28","]",">",">",">","index","=","[","'snail","'",",","'pig","'",",","'elephant","'",",","...","'rabbit","'",",","'giraffe","'",",","'coyote","'",",","'horse","'","]",">",">",">","df","=","ps.DataFrame","(","{","'speed","'",":","speed",",","...","'lifespan","'",":","lifespan","}",",","index=index",")",">",">",">","df.plot.bar","(","x='lifespan","'",")","#","doctest",":","+SKIP"]
code: def bar(self, x=None, y=None, **kwds):
      """
      Vertical bar plot.
  
      Parameters
      ----------
      x : label or position, optional
          Allows plotting of one column versus another.
          If not specified, the index of the DataFrame is used.
      y : label or position, optional
          Allows plotting of one column versus another.
          If not specified, all numerical columns are used.
      **kwds : optional
          Additional keyword arguments are documented in
          :meth:`pyspark.pandas.Series.plot` or
          :meth:`pyspark.pandas.DataFrame.plot`.
  
      Returns
      -------
      :class:`plotly.graph_objs.Figure`
          Return an custom object when ``backend!=plotly``.
          Return an ndarray when ``subplots=True`` (matplotlib-only).
  
      Examples
      --------
      Basic plot.
  
      For Series:
  
      .. plotly::
  
          >>> s = ps.Series([1, 3, 2])
          >>> s.plot.bar()  # doctest: +SKIP
  
      For DataFrame:
  
      .. plotly::
  
          >>> df = ps.DataFrame({'lab': ['A', 'B', 'C'], 'val': [10, 30, 20]})
          >>> df.plot.bar(x='lab', y='val')  # doctest: +SKIP
  
      Plot a whole dataframe to a bar plot. Each column is stacked with a
      distinct color along the horizontal axis.
  
      .. plotly::
  
          >>> speed = [0.1, 17.5, 40, 48, 52, 69, 88]
          >>> lifespan = [2, 8, 70, 1.5, 25, 12, 28]
          >>> index = ['snail', 'pig', 'elephant',
          ...          'rabbit', 'giraffe', 'coyote', 'horse']
          >>> df = ps.DataFrame({'speed': speed,
          ...                    'lifespan': lifespan}, index=index)
          >>> df.plot.bar()  # doctest: +SKIP
  
      Instead of stacking, the figure can be split by column with plotly
      APIs.
  
      .. plotly::
  
          >>> from plotly.subplots import make_subplots
          >>> speed = [0.1, 17.5, 40, 48, 52, 69, 88]
          >>> lifespan = [2, 8, 70, 1.5, 25, 12, 28]
          >>> index = ['snail', 'pig', 'elephant',
          ...          'rabbit', 'giraffe', 'coyote', 'horse']
          >>> df = ps.DataFrame({'speed': speed,
          ...                    'lifespan': lifespan}, index=index)
          >>> fig = (make_subplots(rows=2, cols=1)
          ...        .add_trace(df.plot.bar(y='speed').data[0], row=1, col=1)
          ...        .add_trace(df.plot.bar(y='speed').data[0], row=1, col=1)
          ...        .add_trace(df.plot.bar(y='lifespan').data[0], row=2, col=1))
          >>> fig  # doctest: +SKIP
  
      Plot a single column.
  
      .. plotly::
  
          >>> speed = [0.1, 17.5, 40, 48, 52, 69, 88]
          >>> lifespan = [2, 8, 70, 1.5, 25, 12, 28]
          >>> index = ['snail', 'pig', 'elephant',
          ...          'rabbit', 'giraffe', 'coyote', 'horse']
          >>> df = ps.DataFrame({'speed': speed,
          ...                    'lifespan': lifespan}, index=index)
          >>> df.plot.bar(y='speed')  # doctest: +SKIP
  
      Plot only selected categories for the DataFrame.
  
      .. plotly::
  
          >>> speed = [0.1, 17.5, 40, 48, 52, 69, 88]
          >>> lifespan = [2, 8, 70, 1.5, 25, 12, 28]
          >>> index = ['snail', 'pig', 'elephant',
          ...          'rabbit', 'giraffe', 'coyote', 'horse']
          >>> df = ps.DataFrame({'speed': speed,
          ...                    'lifespan': lifespan}, index=index)
          >>> df.plot.bar(x='lifespan')  # doctest: +SKIP
      """
      from pyspark.pandas import DataFrame, Series
  
      if isinstance(self.data, Series):
          return self(kind="bar", **kwds)
      elif isinstance(self.data, DataFrame):
          return self(kind="bar", x=x, y=y, **kwds)
  
imports: import importlib
  import pandas
  import numpy
  from pandas.core.base import PandasObject
  from pandas.core.dtypes.inference import is_integer
  from pyspark.ml.feature import Bucketizer
  from pyspark.mllib.stat import KernelDensity
  from pyspark.sql import functions
  from pyspark.pandas.missing import unsupported_function
  from pyspark.pandas.config import get_option
  from pyspark.pandas.utils import name_like_string
label_desc: Use image node_id 6 for calling the PandasOnSparkPlotAccessor obj's underlying member method code with example usage: obj.bar(x, y) and returns: self, self