Thuta Learning
IntermediateData & Databasesintermediate

Viewing & Inspecting Data

Relax. We'll talk through this in plain words — no textbook voice.

Quickly inspecting your data

As soon as you've loaded a DataFrame, don't jump straight into analysis. First, check what columns are in the data, how many rows there are, whether the data types are correct, and whether there are any missing values. Think of it as a health check for your data analysis.

  • .head() — shows the first few rows
  • .tail() — shows the last few rows
  • .info() — shows columns, non-null counts, and data types
  • .describe() — shows a numerical summary
python
import pandas as pd

df = pd.DataFrame({
    "Name": ["Alice", "Bob", "Charlie"],
    "Age": [25, 30, 35],
    "Score": [82, 91, 76]
})

print(df.head(2))
print("
--- Data Info ---")
df.info()
print("
--- Summary ---")
print(df.describe())

df.head(2) shows the first 2 rows. df.info() is important for checking data types and whether there are missing values. df.describe() summarizes numeric columns with their count, mean, min, max, and so on.

You should see
Name Age Score 0 Alice 25 82 1 Bob 30 91 --- Data Info --- RangeIndex: 3 entries, 0 to 2 Data columns (total 3 columns): # Column Non-Null Count Dtype --- ------ -------------- ----- 0 Name 3 non-null object 1 Age 3 non-null int64 2 Score 3 non-null int64 --- Summary --- Age Score count 3.0 3.000000 mean 30.0 83.000000 min 25.0 76.000000 max 35.0 91.000000

Info

Before you do any analysis, .info() make it a habit to always check with it. A column that should be numeric can end up as text/object, which can throw off your calculations.

Viewing & Inspecting Data | Thuta Learning