How to represent the trend (upward/downward/no change) of data?
If you expect the trend to be linear, you could fit a linear regression to each row separately, using time to predict number of occurences of a behavior. Then store the slopes.
This slope represents the effect of increasing time by 1 episode on the behavior. It also naturally accounts for the difference in length of the time series.
I have a dataset where each row represents the number of occurrences of certain behaviour. The columns represent a window of a set amount of time. It looks like this:

+----------+----------+----------+----------+-----------+------+
| Episode1 | Episode2 | Episode3 | Episode4 |  Episode5 |  ... |
+----------+----------+----------+----------+-----------+------+
|        2 |        0 |        1 |        3 |           |      |
|        1 |        2 |        4 |        2 |         3 |      |
|        0 |          |          |          |           |      |
+----------+----------+----------+----------+-----------+------+

There are over 150 episodes. I want to find a way to represent each row as a trend, whether the occurrences are exhibiting more/less.
I have tried to first calculate the average/median/sum of every 3/5/10 cells of each row (because each row has different length and many 0 values), and use these to correlate with a horizontal line (which represent the time), the coefficients of these correlations should tell the trend (<0 means downward, >0 upward). The trends will be used in further analysis.
I'm wondering if there is a better way to do this. Thanks.