funny behavior - rubbing vent

my lovebird Yokum was bobbing his head up and down and rubbing his rear end on the perch. The owner before me said it was a girl. Any ideas??