filmov
tv
Python || Pyspark || DataFrame || Withcolumn || Function || Tamil

Показать описание
Python || Pyspark || DataFrame || Withcolumn || Function || Tamil
# withColumn() in DataFrame
# pyspark withColumn is a transformation function.
# Used to change the value
# Convert the datatype of an existing column
# Create new column and many more
spark = SparkSession \
.builder \
.appName("Simple") \
.master("local[*]") \
.getOrCreate()
student_list_tup = [(10, 'Ria', '1000'), (11, 'Suma', '2000'), (12, 'kavi', '3000')]
schema = (StructType()
.add(field='Stu_id', data_type=IntegerType())
.add(field='Stu_name', data_type=StringType())
.add(field='Fees', data_type=StringType())
)
# withColumn() in DataFrame
# pyspark withColumn is a transformation function.
# Used to change the value
# Convert the datatype of an existing column
# Create new column and many more
spark = SparkSession \
.builder \
.appName("Simple") \
.master("local[*]") \
.getOrCreate()
student_list_tup = [(10, 'Ria', '1000'), (11, 'Suma', '2000'), (12, 'kavi', '3000')]
schema = (StructType()
.add(field='Stu_id', data_type=IntegerType())
.add(field='Stu_name', data_type=StringType())
.add(field='Fees', data_type=StringType())
)