I have written code in python for eg: environment:Zeppelin
def variabletype(dataframe):
df = dataframe
num_col_list=['int','float']
numerical_columns ##etc
return cols_list_df
variabletype(df)
I need to apply same function on pyspark dataframe how to do that?
Use the same method you are using currently, for eg
df = spark.createDataFrame(['a', 'a', 'a', 'a', 'a', 'b', 'b', 'b', 'a', 'a', 'b'], 'string').toDF("Data")
def print_cols(df):
print(df.columns)
print_cols(df)
Output:
['Data']
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.