Last active
June 16, 2020 23:36
-
-
Save Mehdi-Amine/145609f7e8bc91fe5160b4c1b57aedaf to your computer and use it in GitHub Desktop.
concatenating the columns of the happiness dataset
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def assemble(col1, col2, col3, col4): | |
return np.concatenate((col1, col2, col3, col4), axis=1) | |
csd = assemble(cold[:s], slow[:s], dislike[:s], unhappy) | |
csl = assemble(cold[s:s*2], slow[s:s*2], like[:s], unhappy) | |
cfd = assemble(cold[s*2:s*3], fast[:s], dislike[s:s*2], unhappy) | |
cfl = assemble(cold[s*3:s*4], fast[s:s*2], like[s:s*2], happy) | |
hsd = assemble(hot[:s], slow[s*2:s*3], dislike[s*2:s*3], unhappy) | |
hsl = assemble(hot[s:s*2], slow[s*3:s*4], like[s*2:s*3], happy) | |
hfd = assemble(hot[s*2:s*3], fast[s*2:s*3], dislike[s*3:s*4], happy) | |
hfl = assemble(hot[s*3:s*4], fast[s*3:s*4], like[s*3:s*4], happy) | |
bsd = assemble(burning[:s], slow[s*4:s*5], dislike[s*4:s*5], unhappy) | |
bsl = assemble(burning[s:s*2], slow[s*5:s*6], like[s*4:s*5], unhappy) | |
bfd = assemble(burning[s*2:s*3], fast[s*4:s*5], dislike[s*5:s*6], unhappy) | |
bfl = assemble(burning[s*3:s*4], fast[s*5:s*6], like[s*5:s*6], happy) | |
# tea internet book | |
tib = np.concatenate((csd, csl, cfd, cfl, hsd, hsl, hfd, hfl, bsd, bsl, bfd, bfl), axis=0) | |
# printing results | |
tib[:5], tib.shape | |
''' | |
Out: | |
(array([[11.236, 12.965, 0. , 0. ], | |
[28.521, 3.448, 0. , 0. ], | |
[21.96 , 17.448, 0. , 0. ], | |
[17.96 , 12.262, 0. , 0. ], | |
[ 4.681, 3.144, 0. , 0. ]]), (6000, 4)) | |
''' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment