import pandas as pd
import numpy as np
df = pd.read_csv('hr_satisfaction.csv')
df.head()
df.drop(columns='employee_id', inplace=True)
df.head()
- Pivot Table : to see Total number (All) in the table, add -> margins=True
df.pivot_table(values='left', index='department', aggfunc=np.sum, margins=True)
df.pivot_table(values='left', index='department', aggfunc=np.sum, margins=True)
df_grouped = df.groupby('department')
df_grouped['left'].sum()
df.pivot_table(values = df.loc[:], index='department', aggfunc=np.sum, margins=True)
df_grouped = df.groupby('department')
df_grouped.sum()