I need to do something like:
def first_items(x: pd.Series):
"""Helper function for items those aren't NA."""
arr = x.values
arr = np.unique(arr[~pd.isna(arr)])
if not len(arr):
return np.nan
elif len(arr) == 1:
return arr[0]
else:
return arr
tmp.groupby(groups).agg(first_items)
I am interested in doing that in PL SQL. How can I do that?