def convert_collection_to_pandas(val, indexing_type=None):
    """
    Converts list/dict to DataFrame

    :param val: list or dict
    :returns: pandas DataFrame
    """
    try:
        import pandas
    except ImportError:
        raise ImportError(
            textwrap.dedent(
                """
                    No module named 'pandas'. You can install it with follow command:

                    > pip install twelvedata[pandas] 

                    or 

                    > pip install pandas
                """
            ).strip()
        )

    if isinstance(val, (list, tuple)):
        if len(val) == 0:
            return pandas.DataFrame()
        else:
            columns_beg = tuple(val[0].keys())
            columns_end = tuple(val[-1].keys())
            get_row = operator.itemgetter(*columns_end)
            data = [get_row(add_null_obj_values(obj, columns_end)) if
                    columns_beg != columns_end else
                    get_row(obj) for obj in val]
            return pandas.DataFrame(data, columns=columns_end)
    elif isinstance(val, dict):
        try:
            return pandas.DataFrame.from_dict(val, orient="index", dtype="float")
        except ValueError:
            return pandas.DataFrame.from_dict(
                {'data_key': val}, orient="index", dtype="object"
            )
    else:
        raise ValueError("Expected list, tuple or dict, but {} found".format(type(val)))

    Converts list/dict to DataFrame

    :param val: list or dict
    :returns: pandas DataFrame
    
src/twelvedata/utils.py