0

I have the following script. I would like to combine the two for loops into one loop. How do I do that?

for index, row df.iterrows():
    for tag in df.tag.unique()):
        print(row)
        print(tag)
  • Start by providing a sample of data and the expected output. Also, is your goal really to print all combinations of rows and tags? or do you want to perform a calculation? `iterrows` should be avoided – mozway Feb 16 '22 at 06:11
  • @Mayank I have the feeling that the issue is something else ;) – mozway Feb 16 '22 at 06:14
  • @mozway Let's wait for OP to explain the issue. Will reopen if it's something else, otherwise better keep it closed ;) – Mayank Porwal Feb 16 '22 at 06:15
  • @Mayank I was about to vote to close for lack of details ;) – mozway Feb 16 '22 at 06:17

0 Answers0