I'm building genetic algorithm to feature selection in python. I have extracted features from my datas, then I divided into two dataframe, 'train' and 'test' dataframe. How can I multiple the values for each row in 'population' dataframe (each individu) and 'train' dataframe?
'train' dataframe:
feature0 feature1 feature2 feature3 feature4 feature5
0 18.279579 -3.921346 13.611829 -7.250185 -11.773605 -18.265003
1 17.899545 -15.503942 -0.741729 -0.053619 -6.734652 4.398419
4 16.432750 -22.490190 -4.611659 -15.247781 -13.941488 -2.433374
5 15.905368 -4.812785 18.291712 3.742221 3.631887 -1.074326
6 16.991823 -15.946251 8.299577 8.057511 8.057510 -1.482333
'population' dataframe:
0 1 2 3 4 5
0 1 1 0 0 0 1
1 0 1 0 1 0 0
2 0 0 0 0 0 1
3 0 0 1 0 1 1
Multiplying each row in 'population' to all rows in 'train'. It will results:
1) From population row 1:
feature0 feature1 feature2 feature3 feature4 feature5
0 18.279579 -3.921346 0 0 0 -18.265003
1 17.899545 -15.503942 0 0 0 4.398419
4 16.432750 -22.490190 0 0 0 -2.433374
5 15.905368 -4.812785 0 0 0 -1.074326
6 16.991823 -15.946251 0 0 0 -1.482333
2) From population row 2:
feature0 feature1 feature2 feature3 feature4 feature5
0 0 -3.921346 0 -7.250185 0 0
1 0 -15.503942 0 -0.053619 0 0
4 0 -22.490190 0 -15.247781 0 0
5 0 -4.812785 0 3.742221 0 0
6 0 -15.946251 0 8.057511 0 0
And so on...