Paul Oyster
Paul Oyster

Reputation: 1233

Is there a way to do cumulative np.bitwise_or in pandas groups?

I'm looking to something equivalent to:

s.groupby(k).sum()

Upvotes: 3

Views: 803

Answers (1)

mdurant
mdurant

Reputation: 28684

At a guess, this may be what you are after

df.groupby(k).agg(lambda x: np.bitwise_or.reduce(x.values))

Upvotes: 4

Related Questions