Closed
Description
consider the following example
a = rand(100)
b = np.floor(rand(100)*100)
df = pd.DataFrame({'a' : a , 'b' : b})
grp = df.groupby(df.b)
I have grouped the values in a
by b
.
Now, if I want to plot the trend over the groups with mean and std I can do
grp.a.agg([np.mean, lambda x : np.mean(x) + np.std(x) , lambda x : np.mean(x) - np.std(x) ]).plot()
which gives me
SpecificationError: Function names must be unique, found multiple named <lambda>
while
grp.a.agg([np.mean, lambda x : np.mean(x) + np.std(x) ]).plot()
which has just one lambda works ok.
Is this a bug?
In order to make the thing work I had to define real functions (i.e. in terms of def
), to be put in agg
.