Python Pandas two conditional dataframe groupby running sort -


i'm looking way run 2 conditional pandas dataframe groupby method. have many logs parse , have following single condition groupby method, there way have 2 conditional groupby method?

df[df['feature enabled'] == 1].groupby([’feature active'])[['value1','value2']].mean() 

is there way print running groupby current log go through each file, like...

df[df['iteration'] == currentlog_id , df['feature enabled'] == 1].groupby([’feature active'])[['value1','value2']].mean() 

this me plot excel after each log go along , process directory of logs.

thanks

to use multiple conditions need use bit-wise & , not and, need enclose conditions in parentheses due operator precedence:

df[(df['iteration'] == currentlog_id) & (df['feature enabled'] == 1)].groupby([’feature active'])[['value1','value2']].mean() 

should work


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -