pyspark Column is not iterable
<p>Having this dataframe I am getting Column is not iterable when I try to groupBy and getting max: </p>

<pre><code>linesWithSparkDF
+---+-----+
| id|cycle|
+---+-----+
| 31|   26|
| 31|   28|
| 31|   29|
| 31|   97|
| 31|   98|
| 31|  100|
| 31|  101|
| 31|  111|
| 31|  112|
| 31|  113|
+---+-----+
only showing top 10 rows


ipython-input-41-373452512490&gt; in runlgmodel2(model, data)
     65     linesWithSparkDF.show(10)
     66 
---&gt; 67     linesWithSparkGDF = linesWithSparkDF.groupBy(col("id")).agg(max(col("cycle")))
     68     print "linesWithSparkGDF"
     69 

/usr/hdp/current/spark-client/python/pyspark/sql/column.py in __iter__(self)
    241 
    242     def __iter__(self):
--&gt; 243         raise TypeError("Column is not iterable")
    244 
    245     # string methods

TypeError: Column is not iterable
</code></pre>