I'm assuming you are using Python.
In order to use the IntegerType, you first have to import it with the following statement:
from pyspark.sql.types import IntegerType
If you plan to have various conversions, it will make sense to import all types. ...