Untitled

mail@pastecode.io avatar
unknown
python
5 months ago
576 B
6
Indexable
Never
df_base = pd.read_csv("datasets/base.csv", index_col=0)
df_base.head()

train = pd.read_csv("datasets/train.csv", index_col=0)
train.head()

base_matrix = df_base. values
delta = 90000
distance_list = []
for x in range(2000):
    one_array = train. drop('Target', axis=1). iloc[x]. values
    targ_value = train['Target']. iloc[x]
    rast = np.sum((base_matrix-one_array)**2, axis=1)**0.5
    distance_list. append(len(rast[rast<sum((df_base. loc[targ_value]. values-one_array)**2)**0.5]))
len(distance_list)

pd.Series(distance_list). describe(). astype(int)