I need to create dataframe based on the set of columns names and data types. But data types are given in str, int, float etc.. but I need to convert these to StringType, IntegerType etc.. needed for StructType/StructField.

I can create simple mapping do the job but I like to know if there any automatic conversion of these type?