Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

pandas select a row

#select the first row 
df.iloc[1]
#select the first row and return the value in column ['Biologie']
candidate_df.iloc[1]['Biologie']
Comment

select rows from dataframe pandas

from pandas import DataFrame

boxes = {'Color': ['Green','Green','Green','Blue','Blue','Red','Red','Red'],
         'Shape': ['Rectangle','Rectangle','Square','Rectangle','Square','Square','Square','Rectangle'],
         'Price': [10,15,5,5,10,15,15,5]
        }

df = DataFrame(boxes, columns= ['Color','Shape','Price'])

select_color = df.loc[df['Color'] == 'Green']
print (select_color)
Comment

pandas select a row

#select the first row 
df.iloc[1]
#select the first row and return the value in column ['Biologie']
candidate_df.iloc[1]['Biologie']
Comment

select rows from dataframe pandas

from pandas import DataFrame

boxes = {'Color': ['Green','Green','Green','Blue','Blue','Red','Red','Red'],
         'Shape': ['Rectangle','Rectangle','Square','Rectangle','Square','Square','Square','Rectangle'],
         'Price': [10,15,5,5,10,15,15,5]
        }

df = DataFrame(boxes, columns= ['Color','Shape','Price'])

select_color = df.loc[df['Color'] == 'Green']
print (select_color)
Comment

PREVIOUS NEXT
Code Example
Python :: pandas crosstab 
Python :: tensorflow adam 
Python :: python foreach list 
Python :: pygame mirror image 
Python :: how to check for missing values in pandas 
Python :: python if in range 
Python :: get all subsets of a list python 
Python :: wait driver selenium 
Python :: how to close a python program 
Python :: difference between supervised and unsupervised learning 
Python :: np where nan 
Python :: matplotlib savefig size 
Python :: get token from request django 
Python :: how to get the first key of a dictionary in python 
Python :: number of column in dataset pandas 
Python :: python how to get the last element in a list 
Python :: pandas get value not equal to 
Python :: windows 10 reset django migrations 
Python :: python email 
Python :: sorting tuples 
Python :: text widget get tkinter 
Python :: poetry python download windows 
Python :: python num2words installation 
Python :: python face recognition 
Python :: dataset for cancer analysis in python 
Python :: aws lambda environment variables python 
Python :: yaxis on the right matplotlib 
Python :: time difference between timestamps python 
Python :: python tkinter get image size 
Python :: embed image in html from python 
ADD CONTENT
Topic
Content
Source link
Name
9+6 =