## 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/trends.py
"max": "MAX({math_prop})",
    "median": "percentile_disc(0.5) WITHIN GROUP (ORDER BY {math_prop})",
    "p90": "percentile_disc(0.9) WITHIN GROUP (ORDER BY {math_prop})",
    "p95": "percentile_disc(0.95) WITHIN GROUP (ORDER BY {math_prop})",
    "p99": "percentile_disc(0.99) WITHIN GROUP (ORDER BY {math_prop})",
}
def build_dataframe(aggregates: QuerySet, interval: str, breakdown: Optional[str] = None) -> pd.DataFrame:
    if breakdown == "cohorts":
        cohort_keys = [key for key in aggregates[0].keys() if key.startswith("cohort_")]
        
        
        
        dataframe = pd.melt(
            pd.DataFrame(aggregates), id_vars=[interval, "count"], value_vars=cohort_keys, var_name="breakdown",
        ).rename(columns={interval: "date"})
        
        dataframe = dataframe[dataframe["value"] == True]
        
        dataframe = dataframe.groupby(["breakdown", "date"], as_index=False).sum()
    else:
        dataframe = pd.DataFrame(
            [
                {"date": a[interval], "count": a["count"], "breakdown": a[breakdown] if breakdown else "Total",}
                for a in aggregates
            ]
        )
    if interval == "week":
        dataframe["date"] = dataframe["date"].apply(lambda x: x - pd.offsets.Week(weekday=6))
    return dataframe
def group_events_to_date(