title: PySpark: How to judge column type of dataframe
body: <p>Suppose we have a dataframe called <code>df</code>. I know there is way of using <code>df.dtypes</code>. However I prefer something similar to</p>
  
  <p><code>type(123) == int # note here the int is not a string</code></p>
  
  <p>I wonder is there is something like:</p>
  
  <p><code>type(df.select(&lt;column_name&gt;).collect()[0][1]) == IntegerType</code></p>
  
  <p>Basically I want to know the way to directly get the object of the class like <code>IntegerType, StringType</code> from the dataframe and then judge it. </p>
  
  <p>Thanks!</p>