1

I wish to store strings in multidimensional array. I tried using numpy package along with following line:

    co_entity = np.zeros((5000,4))

However, I need to store strings later on. This matrix cannot be used to store strings as it has floats/int. I tried using list to store the strings but since the number of input is dynamic, I have to use multidimensional array with upper limit.

Any ideas for this?

1 Answer 1

1

You could try object type with empty() function like so

co_entity = np.empty((5000,4), dtype='object')

This will allow you to store a string in each of the elements generated.

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.