You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "zhengruifeng (via GitHub)" <gi...@apache.org> on 2023/08/31 09:21:06 UTC

[GitHub] [spark] zhengruifeng commented on a diff in pull request #42748: [SPARK-45028][PYTHON][DOCS] Refine docstring of `DataFrame.drop`

zhengruifeng commented on code in PR #42748:
URL: https://github.com/apache/spark/pull/42748#discussion_r1311348094


##########
python/pyspark/sql/dataframe.py:
##########
@@ -5503,13 +5502,15 @@ def drop(self, *cols: "ColumnOrName") -> "DataFrame":  # type: ignore[misc]
         | 16|    85|
         +---+------+
 
-        Can not drop col('name') due to ambiguous reference.
-
+        Example 5: Can not drop col('name') due to ambiguous reference.
+        >>> from pyspark.sql.functions import col
         >>> df3.drop(col("name")).show()
         Traceback (most recent call last):
         ...
         pyspark.errors.exceptions.captured.AnalysisException: [AMBIGUOUS_REFERENCE] Reference...
 
+        Example 6: Can not find a column matching the expression "a.b.c".
+        >>> from pyspark.sql.functions import lit

Review Comment:
   let's follow the `quick start` example in this PR:
   
   `from pyspark.sql import functions as sf`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org