Gaurav Bansal Gaurav Bansal - 1 year ago 29
Python Question

Which DataFrame column names in other DataFrame column names in pyspark

I have a two

that have some overlap in column names. How can I see which column names are in the other? In
I can do the following and it works:

colnames(df)[colnames(df) %in% colnames(df2)]

Answer Source

In Python you can use list comprehension like this:

[c for c in df.columns if c in df2.columns]
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download