I have 3 CSV files, I am looping through that to parse data.
So basically I loop through 3 CSV files to make Key Value pairs to make another resultant CSV File.
I want to remove duplicates from that file and duplicates are based on one of the keys
So let me give you a code snippet
for master in master_dict_list:
for data in data_gen_dict_list:
for account in account_list:
if(float(master[account['Target Model']])>0):
deviation = float((random.randint(-int(data['Security deviation %']), int(data['Security deviation %']))))/100
security_weight = float(master[account['Target Model']]) + (float(master[account['Target Model']])*deviation)
security_market_value = float(account['Market Value'])*security_weight/100
shares = round(security_market_value/float(master['Price']))
positions_list.append({
'Account Code' : account['Account Code'],
'Security ID': master['SecurityID'],
'Shares' : shares,
'Security Market Value' : security_market_value,
'Security % Weight' : str(security_weight),
'Security Price' : master['Price']
})
Due to data_gen_dict_list, which has 2 entries, there are duplicates.
I want to remove duplicates where security id and account numbers are the same
Here is what a duplicate could look like
account no : 11 security id : abcd shares : 1 smv : 22
acounnt no : 11 security id : abcd shares : 2 smv : 23
And so on
[automerge]1672422206[/automerge]
@comrade can you help me?