Pandas Excel: Find a list of employees where hire_date is greater than specific date
Pandas: Excel Exercise-15 with Solution
Write a Pandas program to import given excel data (employee.xlsx ) into a Pandas dataframe and find a list of employees where hire_date> 01-01-07. Go to Excel data
Sample Solution:
Python Code :
import pandas as pd
import numpy as np
df = pd.read_excel('E:\employee.xlsx')
df[df['hire_date'] >='20070101']
Sample Output:
emp_id first_name last_name hire_date 4 104 Bruce Ernst 2007-05-21 7 107 Diana Lorentz 2007-02-07 13 113 Luis Popp 2007-12-07 19 119 Karen Colmenares 2007-08-10
Excel Data:
employee.xlsx:
Sheet-1
Sheet-2
Sheet-3
Have another way to solve this solution? Contribute your code (and comments) through Disqus.
Previous: Write a Pandas program to import given excel data (coalpublic2013.xls ) into a dataframe and find all records that include two specific MSHA ID.
Next: Write a Pandas program to import given excel data (employee.xlsx ) into a Pandas dataframe and to sort the records by the hire_date column.
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://198.211.115.131/python-exercises/pandas/excel/python-pandas-excel-exercise-15.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics