Slicing and Indexing Dataframes
Slicing and Indexing Dataframes, in this article i will show you how to slice and index file using Python.
Indexing
- df1.set_index(“Address”)
Creating a List for a Single Column
- list(df1.loc[:”Country”])
Display value in Cell ( row vs column)
- df1.loc[45845854,”Country”]
Display value in column(city to country) which located at row”765758″
- df1.loc[765758,”City”:”Country”]
Display row 1 to 4 and column 1 to 4
- df1.iloc[1:4,1:4]
Display all row and column 1 to 4
- df1.iloc[:,1:4]
Check out loading data From csv json Excel Text Using Python here
Leave a Reply