7. Different methods to add column in spark dataframe (DataBricks)

Поделиться
HTML-код
  • Опубликовано: 12 дек 2024

Комментарии • 2

  • @billcates4048
    @billcates4048 Год назад

    Very nice video

  • @sohombanerjee1711
    @sohombanerjee1711 2 года назад

    When i am trying to use UDF it is giving me a error
    code snippet:
    def encode_bill_sha(s):
    str1=hashlib.sha256(s.encode())
    str_hex=str1.hexdigest()
    return str_hex
    udftest=udf(lambda z:encode_bill_sha(z),StringType())
    df22=df1.withColumn("encoded1",udftest("Bill_raw_text"))
    Error:
    cannot resolve 'encdoded1' given input columns: [Bill_raw_text, age, encoded1, name];
    'Project ['encdoded1]
    +- Project [Bill_raw_text#51, age#52L, name#53, (Bill_raw_text#51) AS encoded1#141]
    +- Relation [Bill_raw_text#51,age#52L,name#53] json