简体   繁体   中英

What does the `--` value mean in a numpy array?

I found that in some other people's data, the value "--" sometimes appear in an numpy array. How to set an array element to be "--" ?

something like this:

[-- -- -- -- -- -- -- -- 0.27969929575920105 0.27994874119758606
 0.27715885639190674 0.26716524362564087 0.2594984173774719
 0.2584466338157654 0.2565436065196991 0.2539260685443878
 0.2531115710735321 0.25570642948150635 0.2644173204898834
 0.26860886812210083]

That's a NumPy " masked array ." It carries with it an array of booleans, and where they are True the data is understood to be invalid--and hence printed as -- .

If you want to see the masked data, it's accessible using the .data property of the masked array (which of course you can print).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM