[
https://issues.apache.org/jira/browse/SPARK-27756?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16843771#comment-16843771
]
Louis Yang commented on SPARK-27756:
------------------------------------
Thanks for the quick close of the idea. It is one line code doesn't mean it is
convenient or intuitive. Just want to provide a few ideas to make spark more
user friendly.
> Add a shape property to DataFrame in pyspark
> --------------------------------------------
>
> Key: SPARK-27756
> URL: https://issues.apache.org/jira/browse/SPARK-27756
> Project: Spark
> Issue Type: Wish
> Components: PySpark
> Affects Versions: 2.4.3
> Reporter: Louis Yang
> Priority: Minor
>
> It will be great if PySpark DataFrame can support simple shape attribute
> which returns the number of rows and columns similar to what
> [pandas|[https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.shape.html]]
> has.
> We can add the following to the DataFrame class
>
> {code:java}
> @property
> def shape(self):
> return (self.count(), len(self.columns)){code}
> Then user in python can simply do
>
> {code:java}
> >>> df.shape
> (10000, 20){code}
> to know the most fundamental information of a dataframe when working
> interactively.
>
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]