FormatCase 类
FormatCase 转换会将列中的每个字符串更改为指定的大小写类型。
示例
from pyspark.context import SparkContext from pyspark.sql import SparkSession from awsgluedi.transforms import * sc = SparkContext() spark = SparkSession(sc) datasource1 = spark.read.json("s3://${BUCKET}/json/zips/raw/data") try: df_output = data_cleaning.FormatCase.apply( data_frame=datasource1, spark_context=sc, source_column="city", case_type="LOWER" ) except: print("Unexpected Error happened ") raise
输出
FormatCase 转换会根据“case_type="LOWER"”参数将“city”列中的值转换为小写字母。生成的“df_output”DataFrame 将包含原始“datasource1”DataFrame 中的所有列,但“city”列的值为小写。
方法
__call__(spark_context, data_frame, source_column, case_type)
FormatCase 转换会将列中的每个字符串更改为指定的大小写类型。
-
source_column– 现有列的名称。 -
case_type– 支持的大小写类型为CAPITAL、LOWER、UPPER、SENTENCE。
apply(cls, *args, **kwargs)
继承自 GlueTransform apply。
name(cls)
继承自 GlueTransform 名称。
describeArgs(cls)
继承自 GlueTransform describeArgs。
describeReturn(cls)
继承自 GlueTransform describeReturn。
describeTransform(cls)
继承自 GlueTransform describeTransform。
describeErrors(cls)
继承自 GlueTransform describeErrors。
describe(cls)
继承自 GlueTransform describe。