3 Useful Functionalities of Pandas
Accelerate your data analysis process
Pandas being the most widely used data analysis library provides many flexible and convenient functionalities that ease and expedite data analysis process. In this post, I will cover 3 of them with related functions and methods to perform the task:
- Deriving new columns using existing columns
- Selecting part of a DataFrame using loc and iloc
- Grouping data
Let’s create a DataFrame first. There are many ways to create a DataFrame but I will create one from stracth using a dictionary:
Derive new columns using existing columns
We may need to create new columns which are more useful for our analysis. There might be some redundant information in a column so we may need to extract a part of it. Pandas provide many useful functions and methods to modify columns in a DataFrame.
We can do an arithmetic operation on a column or using multiple columns to create a new column:
We can create a new column based on a comparison between columns: