Skip to main content
Solved

Pick highest value of per user and keep all other attributes?

  • May 11, 2018
  • 5 replies
  • 9 views

Forum|alt.badge.img

Hi, I have a dataset of point like this

UserID Long Lat Total_count

001 1 1 13

001 2 2 1

002 3 3 20

002 4 4 2

003 5 5 30

003 6 6 5

.....

How can I pick only the user with maximum total count and keep the long/lat attributes in the output?

Best answer by redgeographics

If you sort on UserID and Total_count and then use a Sampler, grouped by UserID to sample the first feature you end up with

UserID Long Lat Total_count
001 1 1 13 002 3 3 20 003 5 5 30

That's what you want, right?

0684Q00000ArKrTQAV.png

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

5 replies

redgeographics
Celebrity
Forum|alt.badge.img+60
  • Celebrity
  • 3703 replies
  • Best Answer
  • May 11, 2018

If you sort on UserID and Total_count and then use a Sampler, grouped by UserID to sample the first feature you end up with

UserID Long Lat Total_count
001 1 1 13 002 3 3 20 003 5 5 30

That's what you want, right?

0684Q00000ArKrTQAV.png


erik_jan
Contributor
Forum|alt.badge.img+22
  • Contributor
  • 2179 replies
  • May 11, 2018

If you sort on UserID and Total_count and then use a Sampler, grouped by UserID to sample the first feature you end up with

UserID Long Lat Total_count
001 1 1 13 002 3 3 20 003 5 5 30

That's what you want, right?

0684Q00000ArKrTQAV.png

Nice and simple, @redgeographics. I was thinking way to complicated.

 


redgeographics
Celebrity
Forum|alt.badge.img+60
  • Celebrity
  • 3703 replies
  • May 11, 2018
Nice and simple, @redgeographics. I was thinking way to complicated.

 

[takes bow]

 

 


Forum|alt.badge.img
  • Author
  • 6 replies
  • May 11, 2018

Thanks @redgeographics. Exactly what I want


Forum|alt.badge.img
  • Author
  • 6 replies
  • May 12, 2018

If you sort on UserID and Total_count and then use a Sampler, grouped by UserID to sample the first feature you end up with

UserID Long Lat Total_count
001 1 1 13 002 3 3 20 003 5 5 30

That's what you want, right?

0684Q00000ArKrTQAV.png

Hi @redgeographics

 

 

 

how about if I want to pick out the userID with 1 row only. For example

 

USerID        Long           Lat              Count

 

001                1                1                    20

 

001                2                2                    1

 

002                3                 3                   5

 

003                4                  4                   20

 

003                5                   5                   6

 

004                6                    6                  9

 

I need to pick out the userID 002 and 004