Filter Excel Employee Records with Pandas
Updated
Problem statement
An Excel workbook contains an Employees worksheet. The worksheet has already been loaded for you as the Pandas DataFrame employees.
Keep only rows where department is exactly "Engineering", years_experience is at least 3, and is_active is true.
Return a DataFrame with the columns employee_id, employee_name, and years_experience, in that order. Sort the rows by employee_id in ascending order. If no row qualifies, return an empty DataFrame with those same columns.
Table schema
Use the same input data with any supported language. Open the Schema tab in the editor to see the generated SQL setup or Pandas DataFrames.
employees
Rows from the already-loaded Employees worksheet.
| Column | Type | Nullable | Description |
|---|---|---|---|
| employee_idPK | Integer | No | Unique employee identifier. |
| employee_name | Text | No | Employee display name. |
| department | Text | No | Case-sensitive department name. |
| years_experience | Integer | No | Completed years of experience. |
| is_active | Boolean | No | Whether the employee is currently active. |
Expected result
Your query or function must return these columns.
| Column | Type | Nullable | Description |
|---|---|---|---|
| employee_id | Integer | No | — |
| employee_name | Text | No | — |
| years_experience | Integer | No | — |
Row order: must match exactly. Numeric tolerance: 0.
Constraints
0 ≤ employees.length ≤ 2,000.employee_idvalues are unique integers in[0, 9,000,000,000,000,000].employee_nameanddepartmentare non-empty strings of at most 100 characters.0 ≤ years_experience ≤ 60.is_activeis boolean.- Department comparison is case-sensitive; do not trim or normalize text.
More Infosys Onsite Interview questions
- Minimum Coins for a TargetONSITE INTERVIEW · Seen Nov 2026
- Delete Duplicate Employee RecordsONSITE INTERVIEW · Seen Nov 2026
- Find Duplicate Employee RecordsONSITE INTERVIEW · Seen Nov 2026
- Minimum Insertion Steps to Make a String PalindromeONSITE INTERVIEW · Seen Nov 2026
- Maximize the Even-Odd Index Product GapONSITE INTERVIEW · Seen Oct 2026
- Minimum Nonadjacent Flips for an Alternating Binary StringONSITE INTERVIEW · Seen Oct 2026
- Tenth-Highest Distinct SalaryONSITE INTERVIEW · Seen Oct 2026
- Assign Cookies With Matching ParityONSITE INTERVIEW · Seen Sep 2026
- Count Equal Code Pairs Within Distance KONSITE INTERVIEW · Seen Sep 2026
- Daily Successful Transactions Per DepartmentONSITE INTERVIEW · Seen Sep 2026
Similar questions at other companies
- Records Created or Updated in a Time WindowPelatro · ONSITE INTERVIEW
- Top Ten Employee SalariesSolytics Partners · ONSITE INTERVIEW
- Latest New JobSphere · ONSITE INTERVIEW
- Employees Whose Manager Left the CompanyZS · ONSITE INTERVIEWZS interview questions
- Employees Above Average SalaryJP Morgan Chase · ONSITE INTERVIEWJP Morgan Chase interview questions
- Employees Without a ManagerBank of America · ONSITE INTERVIEWBank of America interview questions
- Retrieve Every Student RecordLSEG · ONSITE INTERVIEWLSEG interview questions
- Combine Winner and Loser NamesAmazon · ONSITE INTERVIEW
- Conditionally Insert or Update RecordsKlaviyo · ONSITE INTERVIEWKlaviyo interview questions
- Employees with Matching DepartmentsAMD · ONSITE INTERVIEWAMD interview questions