比较两个数据框后我得到了布尔数据框,但是我想用原始值替换该布尔值

时间:2018-09-24 08:25:16

标签: python-3.x data-science

import pandas as pd
import numpy as np
import os

df = pd.read_csv('../aditya/Downloads/DataSet/Breast_Cancer.csv') 
d1 = df.iloc[:,:16]
d2 = df[['id','compactness_se','concavity_se','concavepoints_se','symmetry_se','fractal_dimension_se','radius_worst','texture_worst','perimeter_worst','area_worst','smoothness_worst','compactness_worst','concavity_worst','concave points_worst','symmetry_worst','fractal_dimension_worst']]
final = d2.isin(d1).astype(int)

0 个答案:

没有答案