Oct-27-2021, 09:15 AM
Given it was only 14 rows long I just added the index numbers to the line converting the array to a dataframe...
Join/merge/concat the two dataframes. I'm going round in circles chasing for an answer I don't know exists!
I just want to 'merge' nans_train and nans_test_tr so that the index/ID is sorted in order. Here is a section that shows 13 and 14 missing...
# Convert to dataframe gender_predictions = pd.DataFrame(predictions, columns=['gender'], index=[13,14,48,50,55,61,71,73,83,84,103,106,149,162])My next issue (!)...
Join/merge/concat the two dataframes. I'm going round in circles chasing for an answer I don't know exists!
I just want to 'merge' nans_train and nans_test_tr so that the index/ID is sorted in order. Here is a section that shows 13 and 14 missing...
Output:nans_train
ID age gender usage_meeting_place usage_worship usage_arts usage_wellbeing usage_connections usage_model_sustainability usage_flexible_community/church usage_services usage_festivals usage_reflection modify_exterior modify_interior modify_sustainable_building modify_layout modify_cafe
0 3 1 2.0 3 3 2 1 3 4 4 2 3 1 3 4 2 3 1
1 4 2 1.0 4 4 4 4 4 3 4 4 4 3 4 4 4 4 4
2 5 2 1.0 4 3 4 4 4 4 4 4 4 3 4 4 4 4 4
3 6 2 2.0 4 2 4 4 4 4 4 2 2 3 2 3 4 4 4
4 7 2 1.0 4 3 4 1 1 0 4 2 2 2 4 4 4 4 0
5 8 2 2.0 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
6 9 1 2.0 3 2 3 3 3 3 2 2 1 1 3 3 4 3 3
7 10 1 2.0 4 2 2 3 4 2 2 2 2 4 3 2 2 2 4
8 11 1 1.0 4 0 3 3 4 3 2 2 3 2 3 4 3 4 4
9 12 3 1.0 4 4 4 4 4 4 4 4 4 4 3 3 3 4 4
10 13 2 1.0 4 4 4 3 3 3 3 3 4 2 4 4 4 4 4
11 14 3 1.0 4 4 4 4 4 4 4 4 4 4 2 3 3 2 3
12 15 2 2.0 4 3 3 4 4 4 4 3 3 3 3 4 4 3 4
15 18 2 2.0 4 4 4 4 4 4
Output:nans_test_tr
ID age usage_meeting_place usage_worship usage_arts usage_wellbeing usage_connections usage_model_sustainability usage_flexible_community/church usage_services usage_festivals usage_reflection modify_exterior modify_interior modify_sustainable_building modify_layout modify_cafe gender
13 16 2 4 2 4 4 4 2 2 2 2 2 3 3 2 4 4 2.0
14 17 1 4 4 4 4 4 1 4 1 1 0 2 3 4 3 0 1.0