Slicing
and Dicing in Python
Slicing and dicing is used for data exploration.In this activity data is divided into small parts and exploration of same is done.
Slicing and dicing is used for data exploration.In this activity data is divided into small parts and exploration of same is done.
Deleting
columns- It is used to remove the unwanted columns from the data.It is one of the step require to remove the columns which are not required for modelling
del
data[‘column’]
Selecting
a specific column
To
select the individual column from the dataset below syntax is used
data[‘column’]
data.column
Afterwards one can do further exploration by using
data['column'].value_counts()
Afterwards one can do further exploration by using
data['column'].value_counts()
Selecting
multiple columns
If one wants to explore data in two columns below syntax can be used and exploration can be done
If one wants to explore data in two columns below syntax can be used and exploration can be done
data[[‘column1’,’columns2]]
# Multiple columns are passed in a list
Subsetting
rows in Python
Python
works on 0 based indexing
data[0:3] #Selecting rows 1,2,3
data[-1:] #Selecting last element
data_copy
= data.copy() # Copy data frame
No comments:
Post a Comment