Skip to content

Commit ebe39f6

Browse files
zhengruifengdongjoon-hyun
authored andcommitted
[MINOR][DOCS] Fix the examples of createDataFrame
### What changes were proposed in this pull request? Fix the examples of createDataFrame `collect` -> `show` ### Why are the changes needed? existing examples generate different outputs ### Does this PR introduce _any_ user-facing change? doc only changes ### How was this patch tested? manually test in `bin/pyspark` ### Was this patch authored or co-authored using generative AI tooling? no Closes #49475 from zhengruifeng/py_doc_create_df. Authored-by: Ruifeng Zheng <[email protected]> Signed-off-by: Dongjoon Hyun <[email protected]>
1 parent e945a90 commit ebe39f6

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

python/pyspark/sql/session.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1467,7 +1467,9 @@ def createDataFrame( # type: ignore[misc]
14671467
+-----+---+
14681468
|Alice| 1|
14691469
+-----+---+
1470-
>>> spark.createDataFrame(pandas.DataFrame([[1, 2]])).collect() # doctest: +SKIP
1470+
1471+
>>> pdf = pandas.DataFrame([[1, 2]]) # doctest: +SKIP
1472+
>>> spark.createDataFrame(pdf).show() # doctest: +SKIP
14711473
+---+---+
14721474
| 0| 1|
14731475
+---+---+
@@ -1482,8 +1484,9 @@ def createDataFrame( # type: ignore[misc]
14821484
+-----+---+
14831485
|Alice| 1|
14841486
+-----+---+
1487+
14851488
>>> table = pyarrow.table({'0': [1], '1': [2]}) # doctest: +SKIP
1486-
>>> spark.createDataFrame(table).collect() # doctest: +SKIP
1489+
>>> spark.createDataFrame(table).show() # doctest: +SKIP
14871490
+---+---+
14881491
| 0| 1|
14891492
+---+---+

0 commit comments

Comments
 (0)