aboutsummaryrefslogtreecommitdiff
path: root/python
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:40:58 -0800
commit2358657547016d647cdd2e2d363426fcd8d3e9ff (patch)
tree11ae09948aafbcd7866762ab2f00f1a77ff0bebf /python
parentdf3d559b32f1ceb8ca3491e2a1169c56a6faab58 (diff)
downloadspark-2358657547016d647cdd2e2d363426fcd8d3e9ff.tar.gz
spark-2358657547016d647cdd2e2d363426fcd8d3e9ff.tar.bz2
spark-2358657547016d647cdd2e2d363426fcd8d3e9ff.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()
Diffstat (limited to 'python')
-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))