How to Print Clean, Readable Summaries of a DataFrame in Colab

 



When working in Google Colab, raw DataFrame outputs can quickly become cluttered. 

The goal is to extract concise, structured summaries that are easy to interpret.


1. Use .info() for Structure

df.info()

This gives:

  • Column names

  • Data types

  • Non-null counts

Best for: Quick structural overview.


2. Use .describe() for Statistics

df.describe()

This outputs:

  • Mean, std, min, max

  • Quartiles

For all columns:

df.describe(include='all')


3. Preview Data with .head()

df.head()

Clean, readable snapshot of the first rows.


4. Improve Readability with Display Options

import pandas as pd

pd.set_option('display.max_columns', None)
pd.set_option('display.width', 1000)

Prevents column truncation in Colab.


5. Transpose for Better Layout

df.describe().T

Makes summaries easier to scan vertically.


Final Takeaway

Use a combination of:

  • .info() → structure

  • .describe() → statistics

  • .head() → sample data

Together, they give a clean, complete, and readable snapshot of any dataset in seconds.


Advance Your Career With 16 Python Projects in Data & ML — All for $288.

Comments

Popular posts from this blog

How to Filter Rows Using Boolean Indexing in Pandas (Afrobarometer Kenya Dataset)

How to Decide Whether to Drop or Fill Missing Value

How to create your first line chart with World Bank Kenya GDP data