def to_df(queryset, index_col=None, parse_dates=None):
    """
    :param queryset: django.db.models.query.QuerySet
    :param index_col: str or list of str, optional, default: None
    :param parse_dates: list or dict, default: None
    :return: pandas.core.frame.DataFrame
    """
    try:
        query, params = queryset.query.sql_with_params()
    except EmptyResultSet:
        # Occurs when Django tries to create an expression for a
        # query which will certainly be empty
        # e.g. Book.objects.filter(author__in=[])
        return pd.DataFrame()
    return read_sql_query(query, connection, params=params, index_col=index_col, parse_dates=parse_dates)

    :param queryset: django.db.models.query.QuerySet
    :param index_col: str or list of str, optional, default: None
    :param parse_dates: list or dict, default: None
    :return: pandas.core.frame.DataFrame
    
panel/models.py