Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def N_rows(net, df, all_views, dist_type='cosine', rank_type='sum'):
from copy import deepcopy
from .__init__ import Network
from . import calc_clust, run_filter
keep_top = ['all', 500, 250, 100, 50, 20, 10]
rows_sorted = run_filter.get_sorted_rows(df['mat'], rank_type)
for inst_keep in keep_top:
tmp_df = deepcopy(df)
check_keep_num = inst_keep
# convert 'all' to -1 to clean up checking mechanism
if check_keep_num == 'all':
check_keep_num = -1
if check_keep_num < len(rows_sorted):
tmp_net = deepcopy(Network())
if inst_keep != 'all':