1

I´ve this numpy array:

array([((-24560412,   18229,   62, 198, 201, 5, -1,   6, 1, 239176.42401979),),
   ...,
   ((-25883120, -681084, 2583, 278, 201, 5,  1, 255, 1, 239424.37447651),)],
  dtype=[('point', [('X', '<i4'), ('Y', '<i4'), ('Z', '<i4'), ('intensity', '<u2'), ('flag_byte', 'u1'), ('raw_classification', 'u1'), ('scan_angle_rank', 'i1'), ('user_data', 'u1'), ('pt_src_id', '<u2'), ('gps_time', '<f8')])])

How can I access Z column values as an array, like points['Z']?

4
  • can you upload the data? Commented Jun 22, 2019 at 20:30
  • I think the dtype description and the data I posted is enough to show the situation, and the data is huge as well. Commented Jun 22, 2019 at 20:34
  • try array_name['point']['Z'] Commented Jun 22, 2019 at 20:38
  • 1
    This is a straight forward structured array access - except that you have fields within a field. arr['point'] gives you a simpler structured array. Commented Jun 22, 2019 at 21:16

1 Answer 1

1

you should be able to do:

array_name['point']['Z']
Sign up to request clarification or add additional context in comments.

3 Comments

yes. You need to use code format when you write code. Use 4 spaces for the code line
@serafeim ohhh understand now, sorry, I rolled-back before I saw this because I was so confused. But I just rolled-back to your revision, thank you!
Notice that triple ticks (```) before and after a code block also works, which is probably more convenient for large blocks of code.

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.