I am using the assign function to add some new columns to my dataframe which are the derived ones from the existing columns of the database.
here's the code -
train2 = pd.read_excel('output1.xlsx')
X_train = (train2.assign(collegeGPA_new = np.power(2.0,(train2["10percentage"] + train2["12percentage"] + train2["collegeGPA"]))).head())
y_train = X_train.Salary
X_train = X_train.drop(['collegeGPA','CollegeTier','Salary','DOB','SalaryL'], axis=1)
Here, 'train2' is my original dataframe, 'collegeGPA_new' is the newly added column and '10percentage', '12percentage', 'collegeGPA', 'Salary', 'DOB', 'SalaryL' are existing columns of the dataframe.
Now the thing is, my dataframe shrinks surprisingly from (3199,628) to (5,628) after deriving X_train. train2 is having shape (3199,628) whereas X_train is having shape (5,628). Where are the other rows going ? What can be the issue here ?
.head()at the end of theassignstatement?