Basic Operations in Pandas After Loading Data
Last Updated: 29th August 2025
Here We will learn some of the most useful functions in Pandas.They are very useful when working with dataframes and series because they provide a lot of information about the dataframe or series.
Let Data is like this
import pandas as pd
import pandas as pd
df = pd.DataFrame({
"Name": ["A", "B", "C","D","E","F"],
"Age": [20, 21, None, 22, 23, 24],
"Marks": [85, 90, 95, 80, None, 70]
})
📊 head() & tail(): Get the first and last 5 rows of the DataFrame.
df.head() # First 5 rows
df.head(2) # First 2 rows
df.tail() # Last 5 rows
df.tail(2) # Last 2 rows
📊 shape: Get the number of rows and columns in the DataFrame.
df.shape
0️⃣ columns: Get the column names of the DataFrame.
df.columns
🔍 dtypes: Get the data types of each column in the DataFrame.
df.dtypes
🔍 info(): Get a summary of the DataFrame, including column names, data types,memory usage and non-null counts.
df.info()
📊 describe(): Give count, mean, std, min, max, etc.
# Summary stats of numeric columns
df.describe()
# Include non-numeric also
df.describe(include="all")
📈 value_counts(): Get counts of unique values in a column.
df["Age"].value_counts()
🆔 unique(): Get unique values in a column.
df["Name"].unique()
🆔 nunique(): Get count of unique values in a column
df["Name"].nunique()
📊 isnull(): Returns True where values are missing, else False.
df.isnull()
📊 isna(): Returns True where values are missing, else False.
df.isna()
📊 notnull(): Returns True where values are not missing, else False.
df.notnull()
📊 notna(): Returns True where values are not missing, else False.
df.notna()