Print dataframe column names from within a function

The print function returns nothing, since all it does is print something and not actually return an object.

You are using an array comprehension ([x for x in items]) instead of a for loop. It sounds like you want

function dfnames(df::DataFrame)
   for name in names(df)
       print(":", name, ", ")
   end
end
2 Likes