I am not sure if this is a valid question but I would like to ask.
Is there a way that i can use a list with column names and generate an empty spark dataframe, the schema should be created with the elements from the list with the datatype for all columns as StringType.
e.g:
column_names = "ColA|ColB|ColC"
def Convert(string):
li = list(string.split("|"))
return li
schema_names = Convert(column_names)
#schema_names = ['ColA', 'ColB', 'ColC']
How can I use this list to create a DF Schema or an empty DF
**This is somewhat similar to How to create an empty DataFrame with a specified schema? , as I am also trying to create empty DF schema, but the approach I am mentioned is different. I am trying to generate the schema from the list.