0
0
Pandasdata~15 mins

info() for column types and nulls in Pandas - Mini Project: Build & Apply

Choose your learning style9 modes available
Using info() to Check Column Types and Nulls in pandas
📖 Scenario: You work as a data analyst. You receive a small dataset about employees in a company. You want to quickly understand the data types of each column and check if there are any missing values.
🎯 Goal: Learn how to use the info() method in pandas to see column data types and count of non-null values.
📋 What You'll Learn
Create a pandas DataFrame with given employee data
Assign the DataFrame to a variable named df
Use the info() method on df to display column types and null counts
Print the output of df.info()
💡 Why This Matters
🌍 Real World
Data scientists and analysts often need to quickly understand the structure of new datasets, including data types and missing values, before starting analysis.
💼 Career
Knowing how to use pandas info() helps in data cleaning and preparation, which is a key skill for data science and analytics jobs.
Progress0 / 4 steps
1
Create the employee DataFrame
Create a pandas DataFrame called df with these exact columns and values:
'Name': ['Alice', 'Bob', 'Charlie', 'David'],
'Age': [25, 30, 35, None],
'Department': ['HR', 'IT', 'Finance', 'IT']
Pandas
Need a hint?

Use pd.DataFrame with a dictionary where keys are column names and values are lists of column values.

2
Prepare to check data info
Assign the DataFrame df to a variable called data to prepare for analysis.
Pandas
Need a hint?

Just assign df to data with data = df.

3
Use info() to check column types and nulls
Call the info() method on the variable data to see the data types and count of non-null values for each column.
Pandas
Need a hint?

Use data.info() to display the summary of the DataFrame.

4
Print the info() output
Print the output of data.info() by calling print() with data.info() inside it.
Pandas
Need a hint?

Use print(data.info()) to show the info output in the console.