Home > Software design >  How can I use "for loop" to output dataframe in order?
How can I use "for loop" to output dataframe in order?

Time:06-23

I want to output dataframes with for loop.

For example, a list (it is just a metaphor)

a=[1, 2, 3, 4]

for i in range(3):
   a[i]

Like this, I want to output "dataframes" in order with for loop. Can I do it? How can I do this?

CodePudding user response:

Since there are no sample dataframes you have provided and assuming you want to just print(output) them. The same methodology could be applied.

Store all the dataframe identifiers in a list and print them using for loop. Here df[s] represent 3 separates dataframe.

lis = [df,df1,df2]
for i in lis:
   print(i)
  • Related