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
  • 55
  • 6

1 Answers1

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