Pandas is a powerful library in Data Analytics and Data Science,
Here are 10 Pandas functions to enhance your Data Analysis skills,
A Thread 𧡠π ( with code snippets )
1 - To Read CSV and Excel files :
These Functions will be used in almost every Project, They are used to read a CSV or an excel file to a pandas DataFrame format.
2 - Head and Tail Function :
βΎ df.head() returns first n rows, if no input is given it returns 5 rows
βΎ df.tail() returns the last n rows, if no input is given it returns 5 rows
3 - Columns Function :
When we have a big dataset with many columns it will be difficult to see all columns, hence we can use df.columns to print all columns
4 - length and Shape Functions :
βΎ len(df) function Provides the length of the DataFrame
βΎ df.shape function returns no of rows and columns in a data frame
5 - Describe Function :
Then to understand the basic statistics of variables we can use df.describe(). It will give you a count, mean, standard deviation, and also 5 number summary.
6 - Nunique Function :
To get the total unique values of variables, we can use df.nunique(). It will give all the unique values a variable contains.
7 - iloc() Function :
This function takes as a parameter the rows and column indices and gives you the subset of the DataFrame accordingly
8 - loc() Function :
This function does almost the similar operation as .iloc() function. But here we can specify exactly which row index we want and also the name of the columns we want in our subset
9 - dtypes Function :
It is necessary to know the data types of the variables before we dive into the analysis, visualization, or predictive modeling, We use this function to find the data type of a Column
10 - Replacing Null Values :
This function .fillna() replaces the null values with some other value of your choice
Bonus :
df.count()
It provides you with the number of data in the DataFrame in the specified direction. When the direction is 0, it provides the number of data in the columns:
That's a wrap!
If you enjoyed this thread:
1. Follow me @Santhoscheeku77 for more of these Data Science & Python content 2. RT the tweet below to share this thread with your audience