0
Good morning to all.
I need a lot of help with a project I’m doing. I’m having trouble getting only the highest values from a dictionary or a list. I’ll try to explain it better:
In AWK language I would do so for the highest values:
if (FILENAME == "..\\temp\\empregados.txt") {
emp = substr($1, 1, 3)+0;
i_emp = substr($1, 5)+0;
if (i_emp > maior[emp])
maior[emp] = i_emp
print $0 > "..\\dados\\empregados.txt"
Here "if (i_emp > major[emp])" is the cat jump, because I create a arrey called "major and step as position of that arrey emp. With this he will tell me of the companies I have registered, which is the code of the largest employee per company.
I haven’t seen how to work with arreys of this type in Python so I can get the biggest code of each company.
Ex: I have csv file separated by "tab" asssim:
codigo_empresa codigo_empregado 2 2-201 2 2-200 2 2-305 2 2-002 3 3-305 3 3-405 3 3-105
And so it goes. I need him to keep the following values: 2 2-305 3 3-405
From now on I thank you all for your subsequent help.
Questions are for... well, questions. If you want to answer your own question, publish a response. Just be careful not to answer only with the code that is working; along with the post code the explanation of what was wrong and how it solved.
– Woss
Thanks for the clarification Anderson Carlos Woss. I’m new here, so I’m not used to working, but I’m adjusting.. Grateful.
– Cleber Nandi
Look at this link
– Solkarped