To sample a specific number of rows from a pandas DataFrame, you can use the sample() function with the n parameter. The n parameter specifies the exact number of rows you want to randomly select.