Typeof

Girişin veri türü için DDL biçimli tür dizesi döndürür.

Sözdizimi

from pyspark.sql import functions as sf

sf.typeof(col)

Parametreler

Parametre Türü Description
col pyspark.sql.Column veya str Türünü almak için sütun.

Örnekler

Örnek 1: Çeşitli sütun türlerini alma

from pyspark.sql import functions as sf
df = spark.createDataFrame([(True, 1, 1.0, 'xyz',)], ['a', 'b', 'c', 'd'])
df.select(sf.typeof(df.a), sf.typeof(df.b), sf.typeof('c'), sf.typeof('d')).show()
+---------+---------+---------+---------+
|typeof(a)|typeof(b)|typeof(c)|typeof(d)|
+---------+---------+---------+---------+
|  boolean|   bigint|   double|   string|
+---------+---------+---------+---------+