Want replications needed to be picked up. | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
0

Want replications needed to be picked up.

I have a csv sheet with 5 columns in which there is a replica is present in different rows. now I want read that data via Python script so that it picks ups only replications rows single time with all details.

16th Feb 2017, 7:38 AM
Mohd Qasim
Mohd Qasim - avatar
5 Respostas
0
What do you want exactly? What I understand is you want the replications to be dropped. But I can be wrong.
16th Feb 2017, 1:28 PM
Amaras A
Amaras A - avatar
0
I have a sheet wid me which contains data eg shown below- name product 1. Tim apple 2. Sam apple 3. John apple 4. Mira mango 5. Sam mango 6. rock mango 7. Cena Shoes 8. Jack shoes 9. John shirt So, in above data I have 7 members with 4 products means some product have replications. Now I want a script that should pick data with product having replications with the user name. And like I say I want 10 no of each user. It should collect the sample for each user and stop picking up the data if required number is achieved and continue for other rater. And most importantly I need data with replication.
16th Feb 2017, 3:20 PM
Mohd Qasim
Mohd Qasim - avatar
0
Maybe, from what I understand now, you should try to group your data by product... and while the length of the group is less than (say) 10 you continue to iterate over your file until you hit a length of 10 or the data is exhausted. Do I understand your need correctly?
17th Feb 2017, 4:04 AM
Amaras A
Amaras A - avatar
0
if I make count from above observation, I got following result- (Tim- 1, Sam - 2, John - 1, Mira - 1, rock - 1) Only I have to focus on replications of the product( max 3) that means I have only consider that data which got replications. I'll not consider data row 7,8 and 9 just because of incomplete replications. It might be possible that I'll find 3rd replica if row 7 and 8 if I extend the data set. In that case I have to consider it. coming to numbers If i say I want atleast 10 dataset for each user which is currently 1 for everyone other then Sam which is 2. So, I have to run the loop untill the required number is achieved. if somehow the dataset for Sam got completed first. Then I have to ignore the data set that have 3 replications with Sam in it, because if I consider that then Sam will become 11. Then we have to focus on other dataset that got replications but without Sam. I hope this explanation Wil help you. hoping for the best result with idea how to achieve it.
17th Feb 2017, 5:14 AM
Mohd Qasim
Mohd Qasim - avatar
- 1
Oh, so that's a Counter, grouping by name, and you ignore all the results for the names that have the required number?
17th Feb 2017, 3:52 PM
Amaras A
Amaras A - avatar