I am a law school graduate. What I offer is mere information, not to be construed as forming an attorney client relationship.
As to female cop versus male cop, no such rule I know of.
As to pat down (known as terry stop), cops can pat a person down if they have reasonable suspicion to believe you are carrying weapons and/or fear for their safety.
IF they feel something that feels like a weapon, they can take it out of your pocket. If it happens to be drugs, you are busted. Why? Because the initial stop was valid.
Is there reason to believe the initial stop was invalid? Were you just walking along? Are you identified as a potential gang banger? Do you fit a profile?