0

I have Latitude and Depth, I want to seprate these two arrays in form of numpy array. [['Latitude' 'Depth'] ['28.00303425' '5067.9097'] ['28.00304059' '5068.656'] ... ['28.01996016' '5067.0303'] ['28.01996016' '5067.0234'] ['28.01996017' '5066.8833']]

1 Answer 1

1

Try this following code snippet. The zip command can be used to split the 2d array into two separate columns/arrays. I used the index "1:" to remove the top row, containing the column names.

data=np.asarray([['Latitude','Depth'],
      ['28.00303425','5067.9097'],
      ['28.00304059','5068.656'],
      ['28.01996017','5066.8833']])

lat, depth = zip(*data[1:])
print(np.asarray(lat))
print(np.asarray(depth))

Output

['28.00303425' '28.00304059' '28.01996017']
['5067.9097' '5068.656' '5066.8833']
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.