I’m sorry if this is a repeat, I can’t find anything that gives me an answer…
I have a dataframe containing pixel values and the number of pixels of that value. It looks something like this:
Value Count
0.1457 900
0.1458 1800
0.1459 900
...
0.7891 1800
0.7892 900
nan 0
nan 0
In this case each instance of nan indicates a single pixel with no data.
I’d like to group these values into 4 classes as follows…:
- Low: <0.2
- Mid: 0.2 – 0.6
- High: ^0.6 [greater than sign is causing the formatting to mess up here]
- No Data: nan
…and then produce a sum for each class, like so:
Class Count
Lo 9900
Mid 1800
Hi 900
ND 20
I appreciate there are likely to be several steps to this, but does anyone have any pointers?