1

I cannot find solutions to that anywhere. What I am trying to achieve is: dataframe grouped by 'Machine' column, next would be average column 'datetime' and last one as a count of 'Barcode'.

Not working attempt:

 result = df.groupby('Machine')['datetime'].aggregate('mean')['Barcode'].aggregate('count')

[1]: https://i.stack.imgur.com/h8HiV.png <-- dateFrame before operation

Pat
  • 17
  • 5

1 Answers1

1
df.groupby(['Machine']).agg({'datetime':'mean', 'Barcode': 'count'})
Andrey Lukyanenko
  • 3,299
  • 2
  • 16
  • 21