0

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?

3
  • Is it array of arrays? What is your first column here? Commented Feb 18, 2016 at 14:25
  • Yes, It is array of arrays Commented Feb 18, 2016 at 14:27
  • if I simply do this: pd.DataFrame(arr) the result is that each row of the dataframe contains an array. But I want the nested arrays splitted into columns Commented Feb 18, 2016 at 14:32

1 Answer 1

4

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
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.