Without a doubt, a male and a female make the best company. The female will defer to the male, who is dominant, and the male will general act peacefully towards the female. If you do opt to keep an opposite-sex pair of cavies together, you will end up having to have one of them fixed, or your female will constantly be manufacturing little baby guinea pigs. With an estrus cycle of 18 days, and a gestation cycle of only two months, it is quite possible for one pair of guinea pigs to produce dozens of offspring in a year. Although each guinea pig is different, as a general rule, males are more active than females, and are slightly larger when fully grown.
Females tend to be smaller and more docile, but they do present some unique problems.
Second, your female may already be pregnant if you bring her home from a pet shop or a friend's home, especially if no care was taken to separate her from her siblings shortly after weaning. And last, if a female does not have a litter before she is about 9 months old, you will need to spay her if there is ever any chance, no matter how remote, that she will become pregnant later. The hip bones of childless sows can start to fuse between 9 and 12 months of age, and future pregnancies can become life-threatening.