Pandas: Finding a Row Where One of Its Values Is at a Minimum/Maximum
Often, we will want to get to get a specific row, which marks the minimum or maximum of one of its columns. Let’s suppose we have the SF Salaries dataset from Kaggle. We want to find the employee name, with the largest total pay benefits. The experience with writing NumPy/Pandas filter conditions will quickly let us produce the following version:
sal[sal['TotalPayBenefits'] == sal['TotalPayBenefits'].max()]['EmployeeName'] which is absolutely valid, but is it the only option?