沿續上一篇dataframe
數據切割
print(employee_df.loc[:2, 'name':'email'])
自定義運算
把欄位一次取出做運算並產生一個新的值
employee_df.loc[(employee_df['salary']> 42000), 'salary_level'] = 'High'
employee_df.loc[(employee_df['salary']<= 42000) & (employee_df['salary']>= 40000), 'salary_level'] = 'normal'
employee_df.loc[(employee_df['salary']< 40000), 'salary_level'] = 'low'
print(employee_df)