code polygon | % cover | fragility |
---|---|---|
a | 50 | 4 |
a | 15 | 5 |
a | 35 | 2 |
b | 100 | 5 |
c | 20 | 1 |
c | 80 | 3 |
d | 100 | 3 |
e | 60 | 2 |
e | 40 | 4 |
I have to summarize the "code polygon" so that from the various entrys corresponding to the same code, it only remains the one with highest "%cover". When you use the summarize tool, for each of the fields of the output table you have to choose which parameters you want to appear. But in this case I would like that the "fragility" value in the output table corresponds to the one in the same entry as the highest "%cover" value. The output table would have to look like this:
code polygon | % cover | fragility |
---|---|---|
a | 50 | 4 |
b | 100 | 5 |
c | 80 | 3 |
d | 100 | 3 |
e | 60 | 2 |
Since I have several thousand entries in my input table, could anyone help me find a way to do this authomatically?
Thanks in advance
Solved! Go to Solution.
If you say automatically, I would answer "using Python code", but there is a manual way too, that can be easily implemented. If you summarize using the "code polygon" and as statistics Maximum of "% cover" you will have a table that contains the code polygon and the maximum % cover found for that code polygon.
You can concatenate those two fields into one, generating a value like a50, b100, c80, etc. If you do this too in your original table, you can use this field to join the fragility from the original table to the summarized table.
Please note that when you have more than one fragility values for a polygon code with the maximum % cover in that polygon code, it will only yield 1 result.
If you say automatically, I would answer "using Python code", but there is a manual way too, that can be easily implemented. If you summarize using the "code polygon" and as statistics Maximum of "% cover" you will have a table that contains the code polygon and the maximum % cover found for that code polygon.
You can concatenate those two fields into one, generating a value like a50, b100, c80, etc. If you do this too in your original table, you can use this field to join the fragility from the original table to the summarized table.
Please note that when you have more than one fragility values for a polygon code with the maximum % cover in that polygon code, it will only yield 1 result.
I appreciate very much your reply. I've done it the way you suggested; it took just several minutes.
Thanks a lot, very helpful!
You may also be interested in this post Query and summarize revisited... by the master Dan Patterson