ValueError: Length mismatch: Expected axis has 0 elements, new values have 2 elements

[解决]ValueError: Length mismatch: Expected axis has 0 elements, new values have 2 elements

错误如下:
ValueError: Length mismatch: Expected axis has 0 elements, new values have 2 elements

代码:

def generate_dataframe():

    _ret = []
    data = pandas.DataFrame(_ret)
    data.columns = ["time", "name", "age"]
    return data

解决方案:

def generate_dataframe():

    _ret = []
    data = pandas.DataFrame(_ret, columns=["time", "name", "age"])
    return data

你可能感兴趣的:(ValueError: Length mismatch: Expected axis has 0 elements, new values have 2 elements)