Here are some
#Pandas interview questions asked in top product based companies for entry level
#Data_Analyst role:
1. Find all unique employee names who work in more than one department.
Sample DataFrame:
df = pd.DataFrame({'EmployeeName': ['John Doe', 'Jane Smith', 'Alice Johnson', 'John Doe'], 'Department': ['Sales', 'Marketing', 'Sales', 'Marketing']})
2. Calculate the monthly average sales for each product. Assume sales data is daily.
Sample DataFrame:
df = pd.DataFrame({'Date':
pd.date_range(start='2023-01-01', end='2023-03-31', freq='D'), 'Product': np.random.choice(['ProductA', 'ProductB'], 90), 'Sales': np.random.randint(100, 500, 90)})
3. Identify the top 3 employees with the highest sales in each quarter.
Sample DataFrame:
df = pd.DataFrame({'Employee': ['John', 'Jane', 'Doe', 'Smith', 'Alice'], 'Quarter': ['Q1', 'Q1', 'Q2', 'Q2', 'Q3'], 'Sales': [200, 150, 300, 250, 400]})
4. Analyze the attendance records to find employees with more than 95% attendance throughout the year.
Sample DataFrame:
df = pd.DataFrame({'Employee': ['John', 'Jane', 'Doe'], 'TotalDays': [365, 365, 365], 'DaysAttended': [365, 350, 360]})
5. Calculate the monthly customer retention rate based on the transaction logs.
Sample DataFrame:
df = pd.DataFrame({'Month': ['Jan', 'Feb', 'Mar', 'Jan', 'Feb', 'Mar'], 'CustomerID': [1, 1, 1, 2, 2, 3], 'TransactionCount': [1, 2, 1, 3, 2, 1]})
6. Determine the average time employees spent on projects, assuming you have start and end dates for each project participation.
Sample DataFrame:
df = pd.DataFrame({'Employee': ['John', 'Jane', 'Doe'], 'ProjectStart':
pd.to_datetime(['2023-01-01', '2023-02-15', '2023-03-01']), 'ProjectEnd':
pd.to_datetime(['2023-01-31', '2023-03-15', '2023-04-01'])})
7. Compute the month-on-month growth rate in sales for each product, highlighting products with more than 10% growth for consecutive months.
Sample DataFrame:
df = pd.DataFrame({'Month': ['Jan', 'Feb', 'Mar', 'Jan', 'Feb', 'Mar'], 'Product': ['A', 'A', 'A', 'B', 'B', 'B'], 'Sales': [200, 220, 240, 150, 165, 180]})
8. Identify the time of day (morning, afternoon, evening) when sales peak for each category of products.
Sample DataFrame:
df = pd.DataFrame({'Category': ['Electronics', 'Clothing', 'Electronics', 'Clothing'], 'TimeOfDay': ['Morning', 'Afternoon', 'Evening', 'Morning'], 'Sales': [300, 150, 500, 200]})
9. Evaluate the distribution of workload among employees based on the number of tasks assigned in the last six months.
Sample DataFrame:
df = pd.DataFrame({'Employee': ['John', 'Jane', 'Doe'], 'TasksAssigned': [20, 25, 15]})
10. Calculate the profit margin for each product category based on revenue and cost data.
Sample DataFrame:
df = pd.DataFrame({'Category': ['Electronics', 'Clothing'], 'Revenue': [1000, 500], 'Cost': [700, 300]})
#pandas #dataanalyst