SELECT COUNT(*) AS TotalEmployee
FROM Employee;
EVALUATE
SUMMARIZECOLUMNS (
"TotalEmployee", COUNTROWS ( Employee )
)
import pandas as pd
# Sample DataFrame
df = pd.DataFrame({
'EmployeeID': [1, 2, 3, 4, 5],
'firstName': ['John', 'Jane', 'Alice', 'Bob', 'Charlie']
})
# Count the total number of employees
total_employees = df.shape[0]
print(total_employees)
| TotalEmployee | 5 |
COUNTROWS ( Employee ): This counts the number of rows in the Employee table. SUMMARIZECOLUMNS: This function is used to create a table with a single column named TotalEmployee, which contains the count of employees.
Leave a Comment