title: PySpark - Aggregating by hourly intervals gives TypeError: Column is not iterable
body: <p>I have a dataframe in this format:</p>
  <pre><code>Datetime (UTC format)            group          value
  2022-04-01 00:00:00+00:00          A              10
  2022-04-03 00:00:00+00:00          A              12.5
  2022-03-01 00:00:00+00:00          B              8
  </code></pre>
  <p>I want to group by each group and then sum the values for that group within each <strong>hourly</strong> interval.</p>
  <p>This is what I have tried so far:</p>
  <pre><code>df = df.withColumn('formatted_time', F.to_timestamp('datetime'))
  df = df.groupBy('group', F.window('formatted_time', '1 hour').alias('model_window')) \
      .sum(F.col('value')).alias('value')
  </code></pre>
  <p>But, running this code gives me the error: <code>TypeError: Column is not iterable </code> in the second line. I looked for solutions online but I haven't been able to figure out the cause of this error.</p>
  <p>Could someone tell me what's going wrong here?</p>