DAT-430 Module 4 Project One - Part 2

docx

School

Southern New Hampshire University *

*We aren’t endorsed by this school

Course

430

Subject

Electrical Engineering

Date

Jan 9, 2024

Type

docx

Pages

1

Uploaded by SuperHumanOyster2735

Report
Southern New Hampshife University DAT 430 Project One Part Two In [1]: M # Import the Libraries import pandas as pd # Read in the csv files. hrTrain= pd.read_csv('HR Training Data.csv') hrData_list = [pd.read_csv(f'HRData ({i}).csv') for i in range(l, In [2]: M print(hrTrain.shape) out[2]: In [3]: M In [4]: M Out[4]: hrTrain.head() 15)] (1000, 35) Age BusinessTravel DailyRate Department DistanceFromHome JobLevel HourlyRate MonthlyRate Monthlylncome JobRole RelationshipSatist Research & Laboratory 0 33 Travel_Rarely 576 Development 27 1 133 21280 17024 Technician 1 56 Travel_Frequently 695 Human 9 5 147 23520 18816 _lluman Resources Resources 2 37 Non-Travel 1424 Sales 24 2 89 14240 11392 Manager Human 3 20 Travel_Frequently 187 Sales 31 2 91 14560 11648 Resources 4 33 Travel Rarely 796 _Research& 5 4 103 16480 13184 esearch Development Director 5 rows x 35 columns 4 # Merge HRData files into a single DataFrame hrData_combined = pd.concat(hrData_list, ignore_index=True) # Concatenate HR Training Data with HRData combined merged_data = pd.concat([hrTrain, hrData_combined], ignore_index=True) print(merged_data.shape) merged_data.head() (7040, 36) Age BusinessTravel DailyRate Department DistanceFromHome JobLevel HourlyRate MonthlyRate Monthlylncome JobRole StandardHours ¢ 0 33 Travel Rarely 576 Researché& 27 1 133 21280 17024 Laboratory 80 Development Technician Human Human 1 56 Travel_Frequently 695 Resources 9 5 147 23520 18816 Resources 80 2 37 Non-Travel 1424 Sales 24 2 89 14240 11392 Manager 80 Human 3 20 Travel_Frequently 187 Sales 31 2 91 14560 11648 Resources 80 Research & Research 4 33 Travel_Rarely 796 Development 5 4 103 16480 13184 Director 80 5 rows x 36 columns Rl In [6]: M # Export merged data to Excel merged_data.to_csv('Merged_HR_Data.csv', index=False)
Discover more documents: Sign up today!
Unlock a world of knowledge! Explore tailored content for a richer learning experience. Here's what you'll get:
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help