Poznámka
Na prístup k tejto stránke sa vyžaduje oprávnenie. Môžete sa skúsiť prihlásiť alebo zmeniť adresáre.
Na prístup k tejto stránke sa vyžaduje oprávnenie. Môžete skúsiť zmeniť adresáre.
Creates a vertical bar plot.
A bar plot presents categorical data with rectangular bars with lengths proportional to the values they represent. It shows comparisons among discrete categories. One axis shows the specific categories being compared, and the other axis represents a measured value.
Syntax
bar(x, y, **kwargs)
Parameters
| Parameter | Type | Description |
|---|---|---|
x |
str | Name of column to use for the horizontal axis. |
y |
str or list of str | Name(s) of the column(s) to use for the vertical axis. Multiple columns can be plotted. |
**kwargs |
optional | Additional keyword arguments. |
Returns
plotly.graph_objs.Figure
Examples
from pyspark.sql import SparkSession
spark = SparkSession.builder.getOrCreate()
data = [("A", 10, 1.5), ("B", 30, 2.5), ("C", 20, 3.5)]
columns = ["category", "int_val", "float_val"]
df = spark.createDataFrame(data, columns)
df.plot.bar(x="category", y="int_val")