Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

iterate rows and columns dataframe

# importing pandas as pd
import pandas as pd
  
# dictionary of lists
dict = {'name':["aparna", "pankaj", "sudhir", "Geeku"],
        'degree': ["MBA", "BCA", "M.Tech", "MBA"],
        'score':[90, 40, 80, 98]}
 
# creating a dataframe from a dictionary
df = pd.DataFrame(dict)
 
# iterating over rows using iterrows() function
for i, j in df.iterrows():
    print(i, j)
    print()
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #iterate #rows #columns #dataframe
ADD COMMENT
Topic
Name
3+5 =