简体   繁体   中英

Converting an array of numpy arrays to DataFrame

I have a numpy object that contains the following:

17506    [0, 0, 0, 0, 0, 0]
17507    [0, 0, 0, 0, 0, 0]
17508    [0, 0, 0, 0, 0, 0]
17509    [0, 0, 0, 0, 0, 0]
17510    [0, 0, 0, 0, 0, 0]
17511    [0, 0, 0, 0, 0, 0]
17512    [0, 0, 0, 0, 0, 0]
17513    [0, 0, 0, 0, 0, 0]
17514    [0, 0, 0, 0, 0, 0]
17515    [0, 0, 0, 0, 0, 0]
17516    [0, 0, 0, 0, 0, 0]
17517    [0, 0, 0, 0, 0, 0]
17518    [0, 0, 0, 0, 0, 0]
17519    [0, 0, 0, 0, 0, 0]

(An array that contains arrays of dtype('int32')) How can I efficiently convert this to data frame in pandas and concantenate it (vertically) to an existing dataframe?

What seems to be the problem? You may need to further describe your data.

a = np.array([np.zeros(6) for _ in range(3)])

>>> pd.DataFrame(a)
   0  1  2  3  4  5
0  0  0  0  0  0  0
1  0  0  0  0  0  0
2  0  0  0  0  0  0

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM