BaşlayınÜcretsiz Başlayın

Applying a UDF to vector data

A dataframe is available called df having a column output of type vector. Its first five rows are shown in the console.

A UDF get_first_udf is available that selects the first element of a vector column.

Bu egzersiz

Introduction to Spark SQL in Python

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Create a new dataframe called df_new by adding a new column to df. Call the new column label .
  • Show the first five rows of df_new.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Add label by applying the get_first_udf to output column
df_new = df.____('____', ____('____'))

# Show the first five rows 
df_new.____
Kodu Düzenle ve Çalıştır