3

I have theses points that I need to be in a 2,N array. I tried using Numpy but couldn't get it to work. Any help will do.

30.90,401.01;96.91,384.22;80.70,340.79;67.38,337.90;55.80,300.26;72.01,299.68;92.28,310.10;99.81,331.53;92.86,340.79;108.49,380.16;108.49,382.48;168.13,373.22;352.83,380.74;474.43,393.48;535.80,409.69;560.70,369.16;550.28,362.79;562.44,333.26;592.55,328.05;605.28,329.79;594.28,363.95;572.28,370.32;549.12,413.17;714.14,469.33;716.45,479.17;203.45,479.75;0.00,479.17;0.22,365.11 

1 Answer 1

2

You can use matrix:

s = '30.90,401.01;96.91,384.22;80.70,340.79'
np.array(np.matrix(s))

Output:

array([[ 30.9 , 401.01],
       [ 96.91, 384.22],
       [ 80.7 , 340.79]])
Sign up to request clarification or add additional context in comments.

1 Comment

This np.matrix option was intended as a convenience for programmers who are used to creating matrices in MATLAB. But look at the np.matrix docs.

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.