## 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/utils.py
from posthog.models import Team
    template = get_template(template_name)
    
    team: Optional[Team] = None
    try:
        team = request.user.team  
    except (Team.DoesNotExist, AttributeError):
        team = Team.objects.first()
    if os.environ.get("OPT_OUT_CAPTURE"):
        
        context["opt_out_capture"] = True
    else:
        context["opt_out_capture"] = team.opt_out_capture if team else False
    if settings.SOCIAL_AUTH_GITHUB_KEY and settings.SOCIAL_AUTH_GITHUB_SECRET:
        context["github_auth"] = True
    if settings.SOCIAL_AUTH_GITLAB_KEY and settings.SOCIAL_AUTH_GITLAB_SECRET:
        context["gitlab_auth"] = True
    if getattr(settings, "SOCIAL_AUTH_GOOGLE_OAUTH2_KEY", None) and getattr(
        settings, "SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET", None
    ):
        if settings.MULTI_TENANCY:
            context["google_auth"] = True
        else:
            google_login_paid_for = False
            try:
                from ee.models.license import License
            except ImportError:
                pass
            else:
                license = License.objects.first_valid()