You are viewing documentation about an older version (1.3.0). View latest version

snowflake.snowpark.DataFrame.drop¶

DataFrame.drop(*cols: ColumnOrName | Iterable[ColumnOrName]) → DataFrame[source]¶

Returns a new DataFrame that excludes the columns with the specified names from the output.

This is functionally equivalent to calling select() and passing in all columns except the ones to exclude. This is a no-op if schema does not contain the given column name(s).

Example:

>>> df = session.create_dataframe([[1, 2, 3]], schema=["a", "b", "c"])
>>> df.drop("a", "b").show()
-------
|"C"  |
-------
|3    |
-------
Copy
Parameters:

*cols – the columns to exclude, as str, Column or a list of those.

Raises:

SnowparkClientException – if the resulting DataFrame contains no output columns.