Python pyspark中其他数据帧列名中的哪些数据帧列名
我有两个Python pyspark中其他数据帧列名中的哪些数据帧列名,python,apache-spark,pyspark,spark-dataframe,Python,Apache Spark,Pyspark,Spark Dataframe,我有两个pysparkDataFrames,它们的列名有些重叠。我怎样才能看到其他列中有哪些列名?在sparkr中,我可以执行以下操作,并且可以正常工作: colnames(df)[colnames(df) %in% colnames(df2)] 在Python中,可以使用如下列表理解: [c for c in df.columns if c in df2.columns] 在Python中,可以使用如下列表理解: [c for c in df.columns if c in df2.col
pyspark
DataFrames
,它们的列名有些重叠。我怎样才能看到其他列中有哪些列名?在sparkr
中,我可以执行以下操作,并且可以正常工作:
colnames(df)[colnames(df) %in% colnames(df2)]
在
Python
中,可以使用如下列表理解:
[c for c in df.columns if c in df2.columns]
在
Python
中,可以使用如下列表理解:
[c for c in df.columns if c in df2.columns]
可以使用以下集合:
set(df.columns) & set(df2.columns)
要创建列表,请将上面的表达式放入list()
可以使用集合:
set(df.columns) & set(df2.columns)
要创建列表,请将上面的表达式放入list()