【问题标题】:Pyspark find where the column is equal to empy list: .where('column = []')Pyspark 查找列等于空列表的位置:.where('column = []')
【发布时间】:2022-07-18 14:47:17
【问题描述】:

.where('column = []')

此操作引发以下错误:

java.lang.RuntimeException: Unsupported literal type class java.util.ArrayList []

如何解决此错误以在我的列中查找空列表?

【问题讨论】:

    标签: python java sql pyspark


    【解决方案1】:

    你可以使用它。这将过滤掉 pyspark 数据框中的空列表。

    import pyspark.sql.functions as sf
    df.filter(sf.size('column_with_lists') > 0)
    

    希望对您有所帮助。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-02-20
      相关资源
      最近更新 更多