What is the best way to view the first few columns of several data frames using a for loop?
Here is what I tried:
DF_List = (df1, df2, df3)
for DF in DF_List:
print DF.head()
Error:
File "<ipython-input-18-bed47d1fdce7>", line 6
print DF.head()
^
SyntaxError: invalid syntax
I also tried: DF_List = (df1, df2, df3) for DF in DF_List: DF.head()
Error:
AttributeError: 'function' object has no attribute 'head'
Note: This question is not a duplicate of the question involving the print function, because it is not dependent on the "print"- see second attempt within the code.