## Is your feature request related to a problem?

There's only 2 files where we use pandas, but pandas is 49MB and numpy is another 86MB, slowing down builds massively.

## Describe the solution you'd like

Replace pandas with a pure SQL/Python solution in
- posthog/queries/trends.py
- posthog/queries/sessions.py

Both of those have equivalent examples in Clickhouse (ee/clickhouse) that don't use Pandas.

## Describe alternatives you've considered

Continue using Pandas and clogging builds

## Additional context



#### *Thank you* for your feature request – we love each and every one!

posthog/queries/sessions/sessions.py
cursor.execute(average_length_time, params)
        time_series_avg = cursor.fetchall()
        if len(time_series_avg) == 0:
            return []
        date_range = pd.date_range(filter.date_from, filter.date_to, freq=interval_freq,)
        df = pd.DataFrame([{"date": a[0], "count": a[1], "breakdown": "Total"} for a in time_series_avg])
        if interval == "week":
            df["date"] = df["date"].apply(lambda x: x - pd.offsets.Week(weekday=6))
        elif interval == "month":
            df["date"] = df["date"].apply(lambda x: x - pd.offsets.MonthEnd(n=0))
        df_dates = pd.DataFrame(df.groupby("date").mean(), index=date_range)
        df_dates = df_dates.fillna(0)
        values = [(key, round(value[0])) if len(value) > 0 else (key, 0) for key, value in df_dates.iterrows()]
        time_series_data = append_data(values, interval=filter.interval, math=None)
        
        totals = [sum(x) for x in list(zip(*time_series_avg))[2:4]]
        overall_average = (totals[0] / totals[1]) if totals else 0
        avg_formatted = friendly_time(overall_average)
        avg_split = avg_formatted.split(" ")
        time_series_data.update(
            {
                "label": "Average Duration of Session ({})".format(avg_split[1]),
                "count": int(avg_split[0]),
                "aggregated_value": int(avg_split[0]),
            }
        )
        time_series_data.update({"chartLabel": "Average Duration of Session (seconds)"})
        result = [time_series_data]
        return result
    def _session_dist(self, base_query: Query, params: QueryParams) -> List[Dict[str, Any]]: