I was iterating over a data frame as below:
for j in set(df.month):
for i in set(df.place):
print(j,i)
is there any way i can combine these for loop to a single one?
I was iterating over a data frame as below:
for j in set(df.month):
for i in set(df.place):
print(j,i)
is there any way i can combine these for loop to a single one?
If you really need to, you can do that with itertools.product
.
import itertools
for j, i in itertools.product(set(df.month), set(df.place)):
print(j, i)