I would like to filter the results of a pandas groupBy directly, without having to store the groupBy result in a variable first. For example:
df = pd.DataFrame([("a", 1)]*3+[("b", 1)]*2+[("c", 1)], columns=["title", "counts"])
res = df.groupby("title").agg({"counts":"sum"}) # I want to skip creating res
my_res = res.loc[res.counts >2]
In the above example, I would like to create my_res
with an one-liner. In Spark/Scala this can be achieved simply by chaining a filter operation, but in pandas filter has a different purpose.