df = pd.DataFrame({
'sp' : ['MM1', 'MM1', 'MM1', 'MM2', 'MM2', 'MM2', 'MM4', 'MM4','MM4'],
'mt' : ['S1', 'S1', 'S3', 'S3', 'S4', 'S4', 'S2', 'S2', 'S2'],
'val' : ['a', 'n', 'cb', 'mk', 'bg', 'dgb', 'rd', 'cb', 'uyi'],
'count' : [3,2,5,8,10,1,2,2,7]
})
df.groupby(['sp', 'mt']).apply(lambda grp: grp.nlargest(1, 'count'))
#!/usr/bin/env python
import time
from pylab import *
ion() # turn interactive mode on
# initial data
x = arange(-8, 8, 0.1);
y1 = sin(x)
y2 = cos(x)
# initial plot
line1, line2, = plot(x, y1, 'r', x, y2, 'b')
line1.axes.set_xlim(-10, 10)
line1.axes.set_ylim(-2, 2)
line1.set_label("line1")
line2.set_label("line2")
legend()
grid()
draw()
# update line 1
for i in xrange(50):
time.sleep(0.1)
# update data
y1 = sin(x + float(i) / 10)
# update plot
line1.set_ydata(y1)
draw()
# update line 2
for i in xrange(50):
time.sleep(0.1)
# update data
y2 = cos(x + float(i) / 10)
# update plot
line2.set_ydata(y2)
draw()
Ищите API-интерфейс анимации Matplotlib. Есть также некоторые примеры ...