[ https://issues.apache.org/jira/browse/SPARK-19428?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15852884#comment-15852884 ]
Luke Miner edited comment on SPARK-19428 at 2/4/17 6:15 PM: ------------------------------------------------------------ That would be fantastic. Would it be possible to generalize it so that you could get more than one if needed? {{df.groupBy("group").agg(head("somecolumn", 10))}} I've also had the use case where people ask me to get the top ten by some criteria for each group. For example, 10 biggest employers in each county. was (Author: lminer): That would be fantastic. Would it be possible to generalize it so that you could get more than one if needed? {{df.groupBy("group").agg(head("somecolumn"))}} I've also had the use case where people ask me to get the top ten by some criteria for each group. For example, 10 biggest employers in each county. > 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: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org