Out of this Pandas table, I did some work.
england best six euros
0 kane grealish sancho sterling
1 foden mount bellingham reece
2 trippier stones walker coady
Here's my code:
for i in range(0, 3):
for g in range(1, 4):
if i+1==g:
a = f'''r{g} = {list(df.iloc[i])}'''
print(a)
My Output:
r1 = ['kane', 'grealish', 'sancho', 'sterling']
r2 = ['foden', 'mount', 'bellingham', 'reece']
r3 = ['trippier', 'stones', 'walker', 'coady']
I've got three variables as an output, but is there a way to get them into local use?
Like, print(r1) should give me ['kane', 'grealish', 'sancho', 'sterling']
Is there a way? Thanks in advance.