All DataFrames can add new columns to themselves. However, as usual, whenever a DataFrame is adding a new column from another DataFrame or Series, the indexes align first before the new column is created.
Appending columns from different DataFrames
Getting ready
This recipe uses the employee dataset to append a new column containing the maximum salary of that employee's department.
How to do it...
- Import the employee data and select the DEPARTMENT and BASE_SALARY columns in a new DataFrame:
>>> employee = pd.read_csv('data/employee.csv')
>>...