Select Rows and Columns by Name or Index in Pandas DataFrame using loc and iloc¶

Select Rows and Columns by Name or Index in Pandas DataFrame using loc and iloc

Select Rows and Columns by Name or Index in Pandas DataFrame using loc and iloc

 

The code will perform the task listed below

(1)import pandas library

(2)import  csv file

(3)display the first 5 Data (head())

(4) Print out Specified column & All Rows as Pandas Series

(5)Print Out Specifed Column & All Rows as Pandas Dataframe

(6)Specified Row ( First 3 Rows) & all Column Print Out

(7) Select First 3 Rows and 1 Specified Column

(8) Select First 2 Rows and 2 Specified Column

(9) Select one Specified Row and one Specified Column Using loc

(10) Select two Specified Row and two specified Column using loc

(11) Select one Specified Row and one Specified Column Using iloc

(12)Select two Specified Row and two specified Column using iloc

(13)Build a DataFrame From Scratch ( Way 2) Using Dictionary

(14)Build a DataFrame From Scratch ( Way 2) Using Tupple and List

(15)Assign Value to Index (Row)

(16)Hide the Index

(17) Select 1 Specified Row and 2 Specified Column with iloc

(18)Build a DataFrame From Scratch ( Way 2) Using List and assign to Dictionary

 

(5) Create a New Dataframe  with the same data source under amazon_2

(6) assign 0 to index_col

 

Leave a Reply

Your email address will not be published. Required fields are marked *

three + 8 =