Table of Content
- Install and Import
- Setup
- Data Structures
- Read and Write
- Inspecting Data
- Selection & Indexing
- Filtering & Boolean Indexing
- Sorting
- Handling Missing Data
- Aggregations & Statistics
- Grouping & Pivoting
- String Methods (
.str
) - Datetime Handling (
.dt
) - Reshaping
- Merging & Joining
- Apply & Lambda
1. Install and Import
- If you are using Anaconda or Google Colab, Pandas usually comes pre-installed.
- If you are using pip (standard Python), you can install it manually.
pip install pandas → downloads and installs the latest stable version of Pandas from PyPI.
pd.__version__ → prints the version number so you know which release you’re working with (useful for debugging or following tutorials).
import pandas as pd → imports the Pandas library and shortens the reference name to pd. This is the universal convention.
2. Setup
- display.max_rows → maximum number of rows to show when printing a DataFrame.
- display.max_columns → maximum number of columns to show.
- display.precision → number of decimal places for floating-point numbers.
pd.set_option('display.max_rows', 20) → when printing a DataFrame, show up to 20 rows.
pd.set_option('display.max_columns', 10) → when printing a DataFrame, show up to 10 columns.
pd.set_option('display.precision', 3) → float numbers will be rounded to 3 decimal places in display.
👉 These settings don’t alter your data — they only make the console or notebook display more user-friendly.
2. Setup
- display.max_rows → maximum number of rows to show when printing a DataFrame.
- display.max_columns → maximum number of columns to show.
- display.precision → number of decimal places for floating-point numbers.
pd.set_option('display.max_rows', 20) → when printing a DataFrame, show up to 20 rows.
pd.set_option('display.max_columns', 10) → when printing a DataFrame, show up to 10 columns.
pd.set_option('display.precision', 3) → float numbers will be rounded to 3 decimal places in display.
👉 These settings don’t alter your data — they only make the console or notebook display more user-friendly.
2. Setup
- display.max_rows → maximum number of rows to show when printing a DataFrame.
- display.max_columns → maximum number of columns to show.
- display.precision → number of decimal places for floating-point numbers.
pd.set_option('display.max_rows', 20) → when printing a DataFrame, show up to 20 rows.
pd.set_option('display.max_columns', 10) → when printing a DataFrame, show up to 10 columns.
pd.set_option('display.precision', 3) → float numbers will be rounded to 3 decimal places in display.
👉 These settings don’t alter your data — they only make the console or notebook display more user-friendly.
Summary
- import pandas as pd
- pd.__version__ → check version
- pd.set_option('display.max_rows', n) → control display
- Series: pd.Series(data, index)
- DataFrame: pd.DataFrame(data, columns, index)
- pd.read_csv('file.csv')
- pd.read_excel('file.xlsx')
- pd.read_json('file.json')
- pd.read_sql(query, connection)
- df.to_csv('file.csv')
- df.to_excel('file.xlsx')