Can't Drop Column (pyspark / databricks)

Viewed 639

I have dataframe where I simply want to delete a column. Here is snippet of data:

enter image description here

I want to drop the "value" column. I have tried the following:

df.drop(col("value"))
df.drop("value")
df.drop(df.value)

I encounter no errors, but the column remains. Do I have to remove the data from the column first? I would not think so. Is there a way to force it to remove the column? Thanks for any response.

1 Answers

Dataframes are immutable, you must refer the variable after dropping it:

df = df.drop("value")
Related