Category : nested-lists

I have a list like this, A = [[0.8922063, 0.26672425], [0.34475611, 0.35976697], [0.33253499, 0.18923898], [0.66872466, 0.46248986], [0.72823733, 0.10537784], [0.40903598, 0.70639412], [0.79926596, 0.90095583], [0.67886544, 0.84573289], [0.3641813, 0.64296743], [0.07461196, 0.74290527]] which is the combination of lists of list and I have another list p = [5,4,2] I need to sum up elements of list A corresponding to ..

Read more

I have a pandas dataframe with a column of lists and I’m trying to filter it out based on another list of lists. id path 101 [‘Activities (DEV)’, ‘public’, ‘_yoyo_log’] 102 [‘Activities (DEV)’, ‘public’, ‘behavior_trackers’] 103 [‘Activities (DEV)’, ‘public’, ‘journal_entries’] 104 [‘Social (PROD)’, ‘public’, ‘starva_activity’] 105 [‘pg-prd (DEV-RR)’, ‘public’, ‘activities’] 106 [‘pg-prd (DEV-RR)’, ‘public’, ‘blackouts’] ..

Read more

I am trying the following problem: https://www.hackerrank.com/challenges/nested-list/problem My approach: if __name__ == ‘__main__’: x = [] for _ in range(int(input())): name = input() score = float(input()) x.append([score, name]) x.sort() minimum_score = x[0][0] for a in x: if a[0] == minimum_score: x.remove(a) second_minimum_score = x[0][0] for b in x: if b[0] == second_minimum_score: print(b[1]) Here whenever ..

Read more