Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python iterate columns

for (columnName, columnData) in df.iteritems():
    print('Column Name : ', columnName)
    print('Column Contents : ', columnData.values)
    
# OUTPUT
#Column Name :  ID
#Column Contents :  [1 2 3]
#Column Name :  NAME
#Column Contents :  ['John' 'James' 'Ana']
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #python #iterate #columns
ADD COMMENT
Topic
Name
5+4 =