ApX logoApX logo
ModelsCalculatorHardwareCoursesPricing
ApX logoApX logo
ModelsCalculatorHardwareCoursesPricing

All Courses

Introduction to Exploratory Data Analysis
Chapter 1: Foundations of Exploratory Data Analysis
What is Exploratory Data Analysis?
Goals of EDA
The EDA Workflow
Tools for EDA: Python Libraries Overview
Setting Up Your Environment
Quiz for Chapter 1
Chapter 2: Data Loading, Inspection, and Initial Cleaning
Loading Data from Various Sources (CSV, Excel, JSON)
First Look at the Data: Shape, Head, Tail
Understanding Data Types (dtypes)
Handling Missing Data: Identification
Strategies for Missing Data: Imputation vs Deletion
Detecting and Handling Duplicate Records
Hands-on Practical: Loading and Initial Cleanup
Quiz for Chapter 2
Chapter 3: Univariate Analysis: Understanding Single Variables
Analyzing Numerical Variables: Central Tendency
Analyzing Numerical Variables: Dispersion
Visualizing Numerical Variables: Histograms
Visualizing Numerical Variables: Box Plots
Analyzing Categorical Variables: Frequency Counts
Visualizing Categorical Variables: Bar Charts
Identifying Outliers using Statistical Methods
Practice: Univariate Exploration
Quiz for Chapter 3
Chapter 4: Bivariate Analysis: Exploring Relationships Between Variables
Numerical vs Numerical: Scatter Plots
Numerical vs Numerical: Correlation Analysis
Visualizing Correlation: Heatmaps
Numerical vs Categorical: Comparative Plots
Categorical vs Categorical: Cross-Tabulation
Visualizing Categorical vs Categorical: Stacked/Grouped Bar Charts
Hands-on Practical: Bivariate Exploration
Quiz for Chapter 4
Chapter 5: Advanced Visualization and Introduction to Feature Engineering
Multivariate Visualization: Pair Plots
Customizing Plots for Clarity (Titles, Labels, Legends)
Introduction to Feature Engineering Concepts
Creating New Features from Existing Ones
Basic Data Transformation: Scaling and Normalization
Handling Categorical Features: Encoding Strategies
Introduction to Dimensionality Reduction Ideas
Summarizing and Reporting EDA Findings
Hands-on Practical: Feature Creation and Summary
Quiz for Chapter 5

First Look at the Data: Shape, Head, Tail

After successfully loading your dataset into a Pandas DataFrame, the immediate next step is to get a quick sense of its overall structure and content. Think of it like opening a new book; you might glance at the number of pages and read the first few lines to get oriented. Pandas provides convenient attributes and methods for exactly this purpose.

Checking the Dimensions: The shape Attribute

Before looking at the actual data values, it's useful to understand the dataset's size. How many observations (rows) and features (columns) does it contain? The shape attribute of a DataFrame returns a tuple representing the dimensions (rows, columns).

Let's assume you have loaded your data into a DataFrame named df:

# Assuming 'df' is your Pandas DataFrame
dimensions = df.shape
print(f"The dataset has {dimensions[0]} rows and {dimensions[1]} columns.")

Knowing the shape is fundamental. A dataset with millions of rows might require different analysis strategies or computational resources than one with only a few hundred. Similarly, the number of columns gives you an initial idea of the data's complexity or "width".

Previewing the Data: head() and tail()

While shape tells you the size, it doesn't show you the actual data. To get a quick look at the first few rows and understand the column names and the type of data they contain, use the head() method.

By default, head() displays the first 5 rows:

# Display the first 5 rows
print("First 5 rows of the dataset:")
print(df.head())

This output is helpful for several reasons:

  1. Verify Data Loading: It confirms that the data loaded somewhat correctly and wasn't entirely garbled.
  2. Column Names: You can see the actual column names. Are they informative? Do they contain spaces or special characters that might need cleaning later?
  3. Data Values: You get a glimpse of the values in each column. Are the numbers in the expected range? Do categorical columns have reasonable entries? Can you spot obvious issues like placeholder values?

You can also specify the number of rows you want to see by passing an integer argument:

# Display the first 10 rows
print("First 10 rows of the dataset:")
print(df.head(10))

Similarly, the tail() method shows you the last few rows of the DataFrame. This is useful for checking if there are any summary rows appended at the end of the file or if the data looks consistent throughout. Like head(), it defaults to 5 rows but accepts an integer argument.

# Display the last 5 rows
print("Last 5 rows of the dataset:")
print(df.tail())

# Display the last 3 rows
print("\nLast 3 rows of the dataset:")
print(df.tail(3))

Using shape, head(), and tail() together provides a quick, essential overview of your dataset's dimensions and a preview of its contents. This initial inspection is a simple but significant step in familiarizing yourself with the data before moving on to more detailed analysis like examining data types or handling missing values.

  • User Guide: Data structure intro - Viewing data, The Pandas Development Team, 2023 - Official documentation for the Pandas library, explaining the head(), tail(), and shape methods.
  • Python for Data Analysis, Wes McKinney, 2022 (O'Reilly Media) - A fundamental book on data analysis with Python and Pandas, authored by the library's creator. It covers initial data inspection methods.
  • Hands-On Machine Learning with Scikit-Learn, Keras, and TensorFlow, Aurélien Géron, 2022 (O'Reilly Media) - A practical guide to machine learning that includes sections on data loading and initial exploration using Pandas methods within a project context.

© 2026 ApX Machine Learning