Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

iterate

# import pandas package as pd
import pandas as pd
  
# Define a dictionary containing students data
data = {'Name': ['Ankit', 'Amit', 'Aishwarya', 'Priyanka'],
                'Age': [21, 19, 20, 18],
                'Stream': ['Math', 'Commerce', 'Arts', 'Biology'],
                'Percentage': [88, 92, 95, 70]}
  
# Convert the dictionary into DataFrame
df = pd.DataFrame(data, columns = ['Name', 'Age', 'Stream', 'Percentage'])
  
print("Given Dataframe :
", df)
  
print("
Iterating over rows using index attribute :
")
  
# iterate through each row and select 
# 'Name' and 'Stream' column respectively.
for ind in df.index:
     print(df['Name'][ind], df['Stream'][ind])
Comment

iterate

# import pandas package as pd
import pandas as pd
  
# Define a dictionary containing students data
data = {'Name': ['Ankit', 'Amit', 'Aishwarya', 'Priyanka'],
                'Age': [21, 19, 20, 18],
                'Stream': ['Math', 'Commerce', 'Arts', 'Biology'],
                'Percentage': [88, 92, 95, 70]}
  
# Convert the dictionary into DataFrame
df = pd.DataFrame(data, columns = ['Name', 'Age', 'Stream', 'Percentage'])
  
print("Given Dataframe :
", df)
  
print("
Iterating over rows using index attribute :
")
  
# iterate through each row and select 
# 'Name' and 'Stream' column respectively.
for ind in df.index:
     print(df['Name'][ind], df['Stream'][ind])
Comment

iterate

# import pandas package as pd
import pandas as pd
  
# Define a dictionary containing students data
data = {'Name': ['Ankit', 'Amit', 'Aishwarya', 'Priyanka'],
                'Age': [21, 19, 20, 18],
                'Stream': ['Math', 'Commerce', 'Arts', 'Biology'],
                'Percentage': [88, 92, 95, 70]}
  
# Convert the dictionary into DataFrame
df = pd.DataFrame(data, columns = ['Name', 'Age', 'Stream', 'Percentage'])
  
print("Given Dataframe :
", df)
  
print("
Iterating over rows using index attribute :
")
  
# iterate through each row and select 
# 'Name' and 'Stream' column respectively.
for ind in df.index:
     print(df['Name'][ind], df['Stream'][ind])
Comment

iterate

# import pandas package as pd
import pandas as pd
  
# Define a dictionary containing students data
data = {'Name': ['Ankit', 'Amit', 'Aishwarya', 'Priyanka'],
                'Age': [21, 19, 20, 18],
                'Stream': ['Math', 'Commerce', 'Arts', 'Biology'],
                'Percentage': [88, 92, 95, 70]}
  
# Convert the dictionary into DataFrame
df = pd.DataFrame(data, columns = ['Name', 'Age', 'Stream', 'Percentage'])
  
print("Given Dataframe :
", df)
  
print("
Iterating over rows using index attribute :
")
  
# iterate through each row and select 
# 'Name' and 'Stream' column respectively.
for ind in df.index:
     print(df['Name'][ind], df['Stream'][ind])
Comment

iterate

# import pandas package as pd
import pandas as pd
  
# Define a dictionary containing students data
data = {'Name': ['Ankit', 'Amit', 'Aishwarya', 'Priyanka'],
                'Age': [21, 19, 20, 18],
                'Stream': ['Math', 'Commerce', 'Arts', 'Biology'],
                'Percentage': [88, 92, 95, 70]}
  
# Convert the dictionary into DataFrame
df = pd.DataFrame(data, columns = ['Name', 'Age', 'Stream', 'Percentage'])
  
print("Given Dataframe :
", df)
  
print("
Iterating over rows using index attribute :
")
  
# iterate through each row and select 
# 'Name' and 'Stream' column respectively.
for ind in df.index:
     print(df['Name'][ind], df['Stream'][ind])
Comment

iterate

# import pandas package as pd
import pandas as pd
  
# Define a dictionary containing students data
data = {'Name': ['Ankit', 'Amit', 'Aishwarya', 'Priyanka'],
                'Age': [21, 19, 20, 18],
                'Stream': ['Math', 'Commerce', 'Arts', 'Biology'],
                'Percentage': [88, 92, 95, 70]}
  
# Convert the dictionary into DataFrame
df = pd.DataFrame(data, columns = ['Name', 'Age', 'Stream', 'Percentage'])
  
print("Given Dataframe :
", df)
  
print("
Iterating over rows using index attribute :
")
  
# iterate through each row and select 
# 'Name' and 'Stream' column respectively.
for ind in df.index:
     print(df['Name'][ind], df['Stream'][ind])
Comment

iterate

# import pandas package as pd
import pandas as pd
  
# Define a dictionary containing students data
data = {'Name': ['Ankit', 'Amit', 'Aishwarya', 'Priyanka'],
                'Age': [21, 19, 20, 18],
                'Stream': ['Math', 'Commerce', 'Arts', 'Biology'],
                'Percentage': [88, 92, 95, 70]}
  
# Convert the dictionary into DataFrame
df = pd.DataFrame(data, columns = ['Name', 'Age', 'Stream', 'Percentage'])
  
print("Given Dataframe :
", df)
  
print("
Iterating over rows using index attribute :
")
  
# iterate through each row and select 
# 'Name' and 'Stream' column respectively.
for ind in df.index:
     print(df['Name'][ind], df['Stream'][ind])
Comment

iterate

# import pandas package as pd
import pandas as pd
  
# Define a dictionary containing students data
data = {'Name': ['Ankit', 'Amit', 'Aishwarya', 'Priyanka'],
                'Age': [21, 19, 20, 18],
                'Stream': ['Math', 'Commerce', 'Arts', 'Biology'],
                'Percentage': [88, 92, 95, 70]}
  
# Convert the dictionary into DataFrame
df = pd.DataFrame(data, columns = ['Name', 'Age', 'Stream', 'Percentage'])
  
print("Given Dataframe :
", df)
  
print("
Iterating over rows using index attribute :
")
  
# iterate through each row and select 
# 'Name' and 'Stream' column respectively.
for ind in df.index:
     print(df['Name'][ind], df['Stream'][ind])
Comment

iterate

# import pandas package as pd
import pandas as pd
  
# Define a dictionary containing students data
data = {'Name': ['Ankit', 'Amit', 'Aishwarya', 'Priyanka'],
                'Age': [21, 19, 20, 18],
                'Stream': ['Math', 'Commerce', 'Arts', 'Biology'],
                'Percentage': [88, 92, 95, 70]}
  
# Convert the dictionary into DataFrame
df = pd.DataFrame(data, columns = ['Name', 'Age', 'Stream', 'Percentage'])
  
print("Given Dataframe :
", df)
  
print("
Iterating over rows using index attribute :
")
  
# iterate through each row and select 
# 'Name' and 'Stream' column respectively.
for ind in df.index:
     print(df['Name'][ind], df['Stream'][ind])
Comment

iterate

# import pandas package as pd
import pandas as pd
  
# Define a dictionary containing students data
data = {'Name': ['Ankit', 'Amit', 'Aishwarya', 'Priyanka'],
                'Age': [21, 19, 20, 18],
                'Stream': ['Math', 'Commerce', 'Arts', 'Biology'],
                'Percentage': [88, 92, 95, 70]}
  
# Convert the dictionary into DataFrame
df = pd.DataFrame(data, columns = ['Name', 'Age', 'Stream', 'Percentage'])
  
print("Given Dataframe :
", df)
  
print("
Iterating over rows using index attribute :
")
  
# iterate through each row and select 
# 'Name' and 'Stream' column respectively.
for ind in df.index:
     print(df['Name'][ind], df['Stream'][ind])
Comment

iterate

# import pandas package as pd
import pandas as pd
  
# Define a dictionary containing students data
data = {'Name': ['Ankit', 'Amit', 'Aishwarya', 'Priyanka'],
                'Age': [21, 19, 20, 18],
                'Stream': ['Math', 'Commerce', 'Arts', 'Biology'],
                'Percentage': [88, 92, 95, 70]}
  
# Convert the dictionary into DataFrame
df = pd.DataFrame(data, columns = ['Name', 'Age', 'Stream', 'Percentage'])
  
print("Given Dataframe :
", df)
  
print("
Iterating over rows using index attribute :
")
  
# iterate through each row and select 
# 'Name' and 'Stream' column respectively.
for ind in df.index:
     print(df['Name'][ind], df['Stream'][ind])
Comment

PREVIOUS NEXT
Code Example
Python :: django database specify schema 
Python :: get_multiple_items_from_list 
Python :: python calculate area diameter circumference circle 
Python :: generate jwt token just passing userid in rest_framework_simplejwt 
Python :: convert a python object and store it in a JSON file in the local system 
Python :: pandas str contains only true 
Python :: python program to convert csv file into pdf 
Python :: pyqt grid layout 
Python :: raise httperror(req.full_url, code, msg, hdrs, fp) urllib.error.httperror: http error 429: too many requests 
Python :: install requests-html modlule click on the link to learn more about requests-html 
Python :: matplotlib get colorwheel 
Python :: average values in a list python 
Python :: R[~i] in python 
Python :: WS2812 Thonny microPython 
Python :: custom port odoo 
Python :: Find Factors of a Number Using for Loop 
Python :: Creating a list with several elements that are distinct or duplicate 
Python :: numpy random sin 
Python :: Combining functions 
Python :: Python slides 
Python :: Sequential Execution EC2 
Python :: move python file 
Python :: Python NumPy atleast_1d Function Example when inputs are in high dimension 
Python :: manipulate sns legend 
Python :: Python NumPy asscalar Function Example 01 
Python :: configure socketio static file python specific content type 
Python :: python __div__ 
Python :: p0, percent, aug (inhabitants coming or leaving each year), p (population to surpass) 
Python :: NumPy unpackbits Syntax 
Python :: # find all text files in directory or any type of files in directory 
ADD CONTENT
Topic
Content
Source link
Name
6+2 =