I'm seeking to translate an SQL query to use RAPIDS. Consider the simplified query below:
(SELECT min(a), max(b), c
FROM T
GROUP BY c) AS result
I have validated the code below, but is this the optimal solution? Is sorting on the group key necessary? Is there a cleaner / more idiomatic way to write it?
from pygdf import DataFrame as gdf
T = gdf(...)
df = gdf({'a':T.a, 'c':T.c}).groupby('c').min().sort_values(by='c')
df['max_b'] = gdf({'b':T.b, 'c':T.c}).groupby('c').max().sort_values(by='c').max_b
result = gdf({'a': df.min_a, 'b': df.max_b, 'c':df.c})