[ 
https://issues.apache.org/jira/browse/SPARK-19428?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15852892#comment-15852892
 ] 

Sean Owen commented on SPARK-19428:
-----------------------------------

Let's see, if as above you could get the nth most recent timestamp per 
individual_id, then you can join back to the original data on individual_id and 
filter the result where timestamp > nth_timestamp. Pardon, I don't have the 
syntax off the top of my head but I think this is straightforward. I'd do it 
that way unless a) actually not doable or b) ends up really slow

> Ability to select first row of groupby
> --------------------------------------
>
>                 Key: SPARK-19428
>                 URL: https://issues.apache.org/jira/browse/SPARK-19428
>             Project: Spark
>          Issue Type: Brainstorming
>          Components: SQL
>    Affects Versions: 2.1.0
>            Reporter: Luke Miner
>            Priority: Minor
>
> It would be nice to be able to select the first row from {{GroupedData}}. 
> Pandas has something like this:
> {{df.groupby('group').first()}}
> It's especially handy if you can order the group as well.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to