2

I have a datframe df, with the df.shape: (971,1)

And I have an array with the anarray.shape: (971,80).

How can I add the array to my dataframe, so that I have the shape: (971,81).

I only find solutions where the array goes into one column, but in my case it should go into several columns.

1 Answer 1

2

I believe you need helper DataFrame with same index like df and then DataFrame.join:

df = df.join(pd.DataFrame(anarray, index=df.index))
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.