name 'astype' is not defined code example Example: name 'StringType' is not defined from pyspark.sql.types import StringType