I have a dataframe in pyspark that looks like this

```
+------------------+--------------------+
|    Community_Area|                Date|
+------------------+--------------------+
|          New City|09/05/2015 01:30:...|
|            Austin|09/04/2015 11:30:...|
|          New City|09/05/2015 12:01:...|
|          Avondale|09/05/2015 12:45:...|
|            Austin|09/04/2015 01:00:...|
|    Auburn Gresham|09/05/2015 10:55:...|
|         West Town|09/04/2015 06:00:...|
|          Avondale|09/05/2015 01:00:...|

```

I'm trying to add a count column so that if a community\_area shows up more than once on the same day, that count will increase as below, first appearance as 1 seems like the right way.

```
    +------------------+--------------------+-----------+
    |    Community_Area|                Date|    Count  |
    +------------------+--------------------+-----------+
    |          New City|09/05/2015 01:30:...|       1   |
    |            Austin|09/04/2015 11:30:...|       1   |
    |          New City|09/05/2015 12:01:...|       2   |
    |          Avondale|09/05/2015 12:45:...|       1   |
    |            Austin|09/04/2015 01:00:...|       2   |
    |    Auburn Gresham|09/05/2015 10:55:...|       1   |
    |         West Town|09/04/2015 06:00:...|       1   |
    |          Avondale|09/05/2015 01:00:...|       2   |

```

...

The goal is to add a rolling 7-day sum column using the window function so the final table has 3 columns (Community, Date, Rolling 7-day sum).

My initial approach is to use the count column to use in the window function.

The code I've used to do that is

```
df4b = df4b.groupby(["Community_Area", "Date"])["Community_Area"].count().reset_index(name="count")
df4b.show()

```