Commit 08621c49 authored by Stanislav's avatar Stanislav
Browse files

initialize arrays with empty values

parent c11a43ce
......@@ -381,7 +381,7 @@ def distance_matrix(df, weights):
n = int(df.shape[0])
columns = df.columns
matrix = np.array([[0] * n] * n)
matrix = np.empty([n, n], dtype=float)
for i in range(df.shape[1]):
single_column_df = df[columns[i]]
......@@ -394,7 +394,7 @@ def distance_matrix(df, weights):
# Helper function for the distance matrix calculation
def calc_distance(df, weight_index, n, weights):
matrix = np.array([[0] * n] * n)
matrix = np.empty([n, n], dtype=float)
npm = df.values
if (isinstance(npm[0], str) and df.name != "cflow"):
......@@ -416,6 +416,7 @@ def calc_distance(df, weight_index, n, weights):
else:
for j in range(n):
matrix[j][j] = 0
first_elem = npm[j]
for k in range(j+1,n):
matrix[j][k] = lev(first_elem, npm[k])
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment