aboutsummaryrefslogtreecommitdiff
path: root/python/pyspark
diff options
context:
space:
mode:
authorJacky Li <jacky.likun@huawei.com>2015-02-26 10:40:58 -0800
committerReynold Xin <rxin@databricks.com>2015-02-26 10:43:20 -0800
commit7c779d8d52a445362fc57e740ce51bdc2e93ad7f (patch)
tree12892f8cbd40d8b99b1344afeaa0727c0b1cccb2 /python/pyspark
parentb5c5e93d71741f3daa7bf9b3de838c36bd234511 (diff)
downloadspark-7c779d8d52a445362fc57e740ce51bdc2e93ad7f.tar.gz
spark-7c779d8d52a445362fc57e740ce51bdc2e93ad7f.tar.bz2
spark-7c779d8d52a445362fc57e740ce51bdc2e93ad7f.zip
[SPARK-6007][SQL] Add numRows param in DataFrame.show()
It is useful to let the user decide the number of rows to show in DataFrame.show Author: Jacky Li <jacky.likun@huawei.com> Closes #4767 from jackylk/show and squashes the following commits: a0e0f4b [Jacky Li] fix testcase 7cdbe91 [Jacky Li] modify according to comment bb54537 [Jacky Li] for Java compatibility d7acc18 [Jacky Li] modify according to comments 981be52 [Jacky Li] add numRows param in DataFrame.show() (cherry picked from commit 2358657547016d647cdd2e2d363426fcd8d3e9ff) Signed-off-by: Reynold Xin <rxin@databricks.com>
Diffstat (limited to 'python/pyspark')
-rw-r--r--python/pyspark/sql/dataframe.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/python/pyspark/sql/dataframe.py b/python/pyspark/sql/dataframe.py
index 6d42410020..aec99017fb 100644
--- a/python/pyspark/sql/dataframe.py
+++ b/python/pyspark/sql/dataframe.py
@@ -272,9 +272,9 @@ class DataFrame(object):
"""
return self._jdf.isLocal()
- def show(self):
+ def show(self, n=20):
"""
- Print the first 20 rows.
+ Print the first n rows.
>>> df
DataFrame[age: int, name: string]
@@ -283,7 +283,7 @@ class DataFrame(object):
2 Alice
5 Bob
"""
- print self._jdf.showString().encode('utf8', 'ignore')
+ print self._jdf.showString(n).encode('utf8', 'ignore')
def __repr__(self):
return "DataFrame[%s]" % (", ".join("%s: %s" % c for c in self.dtypes))