CopyPastor
Detecting plagiarism made easy.
Score: 0.8074781894683838; Reported for: String similarity
Open both answers
Possible Plagiarism
Plagiarized on 2021-10-20
by
Quang Hoang
Original Post
Original - Posted on 2020-07-31
by
BENY
Present in both answers;
Present only in the new answer;
Present only in the old answer;
Pandas has a built-in function for that:
pd.get_dummies( df, columns=['C1','C2'])
Output:
X Y C1_1 C1_2 C1_3 C2_2 C2_3 C2_4
0 0.20 75 1 0 0 1 0 0
1 0.80 12 1 0 0 0 0 1
2 0.90 23 0 1 0 0 1 0
3 0.33 24 0 0 1 0 0 1
Try with `argmax`
#df=df.set_index('Rows')
df['New']=df.values.argmax(1)+1
df
Out[231]:
A B C D E New
Rows
0 0 0 0 1 0 4
1 0 0 1 0 0 3
2 0 1 0 0 0 2
3 0 0 0 1 0 4
4 1 0 0 0 0 1
4 0 0 0 0 1 5
Present in both answers;
Present only in the new answer;
Present only in the old answer;