Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/280.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 为什么数字和数据帧标题之间有零?_Python_Python 3.x_Pandas_Dataframe - Fatal编程技术网

Python 为什么数字和数据帧标题之间有零?

Python 为什么数字和数据帧标题之间有零?,python,python-3.x,pandas,dataframe,Python,Python 3.x,Pandas,Dataframe,不知怎的,当我附加到字典并将其连接到数据帧时,数据帧标题下方会出现一些“0” Open High Low Close 0 0 0 0 Time 2013.10.29 00:00:00 -0

不知怎的,当我附加到字典并将其连接到数据帧时,数据帧标题下方会出现一些“0”

                                  Open      High       Low     Close
                            0         0         0         0
Time                                                       
2013.10.29 00:00:00 -0.001090 -0.003290 -0.006910 -0.006255
2013.10.30 00:00:00 -0.006144 -0.005078 -0.003908 -0.000512
2013.10.31 00:00:00 -0.000442  0.001646  0.002732 -0.000985
2013.11.01 00:00:00 -0.000842 -0.000017  0.000998  0.001132
2013.11.04 00:00:00  0.003941  0.005085  0.005387  0.009340
已解决:


    df={} 

    for name in series.columns: 
        # .... do some series manipulations and convert it to numpy arrays and to lists and so on...
        # => create "list_" which is a list of numbers


        df[name]=pd.Series(list_.copy())   # <--- Here, use a series instead :)

    df=pd.concat(df,axis=1)  
    return df 

df={}
对于series.columns中的名称:
# .... 执行一些系列操作,并将其转换为numpy数组和列表等。。。
#=>创建“列表”,这是一个数字列表

df[name]=pd.Series(list..copy())#你能提供所有的代码还是一个简单的例子?@cmosig已经解决了(见下文)。但我感谢你的参与:-)保持健康

    df={} 

    for name in series.columns: 
        # .... do some series manipulations and convert it to numpy arrays and to lists and so on...
        # => create "list_" which is a list of numbers


        df[name]=pd.Series(list_.copy())   # <--- Here, use a series instead :)

    df=pd.concat(df,axis=1)  
    return df