Xinrong Meng created SPARK-50753:
------------------------------------

             Summary: Make PySpark plot accessor a class property
                 Key: SPARK-50753
                 URL: https://issues.apache.org/jira/browse/SPARK-50753
             Project: Spark
          Issue Type: Sub-task
          Components: PySpark
    Affects Versions: 4.0.0
            Reporter: Xinrong Meng


Previously, the plot property in PySpark DataFrame was simply a placeholder:
```py
>>> from pyspark.sql import DataFrame
>>> DataFrame.plot
<property object at 0x10543fd60>
>>> dir(DataFrame.plot)
['__class__', ... 'getter', 'setter']
```

This caused an issue where Sphinx, the documentation generator, could not 
recognize the chaining methods (e.g., bar, barh, etc.) provided by the plot 
accessor. As a result, it failed to populate the documentation for the 
available plot methods.

We aim to bring PySpark’s plot accessor to parity with the Pandas API on Spark
```py
>>> import pyspark.pandas as ps
>>> ps.DataFrame.plot
<class 'pyspark.pandas.plot.core.PandasOnSparkPlotAccessor'>
```

The plot property in PySpark DataFrame should look like this
```py
>>> from pyspark.sql import DataFrame
>>> DataFrame.plot
<pyspark.sql.plot.core.PySparkPlotAccessor object at 0x10500b070>
>>> dir(DataFrame.plot)
['__call__', ..., '_backends', '_get_plot_backend', 'area', 'bar', 'barh', 
'box', 'data', 'hist', 'kde', 'line', 'pie', 'plot_data_map', 'scatter']
```



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to