title: pyspark py4j.Py4JException: Method and([class java.lang.Integer]) does not exist
body: <p>Can Someone help me to get understand the below error, I'm a newbie to PySpark, started learning.</p>
  <p>When I googled it, the below error occurs, when we compare different types of data types, I did have column called salary as an Integer column? Why am I still getting this error.</p>
  <pre><code>&gt;&gt;&gt; df.printSchema()
  root
   |-- Firstname: string (nullable = true)
   |-- middlename: string (nullable = true)
   |-- lastname: string (nullable = true)
   |-- dob: string (nullable = true)
   |-- sex: string (nullable = true)
   |-- salary: integer (nullable = true)
   |-- CopiedColumn: integer (nullable = true)
   |-- Country: string (nullable = false)
   |-- anotherColumn: string (nullable = false)
  
  &gt;&gt;&gt; df.show()
  +---------+----------+--------+----------+---+------+------------+-------+-------------+
  |Firstname|middlename|lastname|       dob|sex|salary|CopiedColumn|Country|anotherColumn|
  +---------+----------+--------+----------+---+------+------------+-------+-------------+
  |    James|          |   Smith|1991-04-01|  M|300000|     -300000|  India|Another value|
  |  Michael|      Rose|        |2000-05-19|  M|400000|     -400000|  India|Another value|
  |   Robert|          |Williams|1978-09-05|  M|400000|     -400000|  India|Another value|
  |    Maria|      Anne|   Jones|1967-12-01|  F|400000|     -400000|  India|Another value|
  |      Jen|      Mary|   Brown|1980-02-17|  F|  -100|         100|  India|Another value|
  +---------+----------+--------+----------+---+------+------------+-------+-------------+
  
  
  &gt;&gt;&gt; df.withColumn(&quot;lit_value2&quot;, when(col(&quot;salary&quot;) &gt;=400000 &amp; col(&quot;salary&quot;) &lt;= 500000,lit(&quot;100&quot;)).otherwise(lit(&quot;200&quot;))).show()
  Traceback (most recent call last):
    File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;
    File &quot;/opt/mapr/spark/spark/python/pyspark/sql/column.py&quot;, line 115, in _
      njc = getattr(self._jc, name)(jc)
    File &quot;/opt/mapr/spark/spark/python/lib/py4j-0.10.7-src.zip/py4j/java_gateway.py&quot;, line 1257, in __call__
    File &quot;/opt/mapr/spark/spark/python/pyspark/sql/utils.py&quot;, line 63, in deco
      return f(*a, **kw)
    File &quot;/opt/mapr/spark/spark/python/lib/py4j-0.10.7-src.zip/py4j/protocol.py&quot;, line 332, in get_return_value
  py4j.protocol.Py4JError: An error occurred while calling o138.and. Trace:
  py4j.Py4JException: Method and([class java.lang.Integer]) does not exist
          at py4j.reflection.ReflectionEngine.getMethod(ReflectionEngine.java:318)
          at py4j.reflection.ReflectionEngine.getMethod(ReflectionEngine.java:326)
          at py4j.Gateway.invoke(Gateway.java:274)
          at py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:132)
          at py4j.commands.CallCommand.execute(CallCommand.java:79)
          at py4j.GatewayConnection.run(GatewayConnection.java:238)
          at java.lang.Thread.run(Thread.java:748)
  </code></pre>