Pandas Data Manipulation
Learn powerful data manipulation and analysis with Pandas. This is a foundational concept in artificial intelligence and machine learning that professional developers rely on daily. The explanations below are written to be beginner-friendly while covering the depth and nuance that comes from real-world AI/ML experience. Take your time with each section and practice the examples
60 min•By Priygop Team•Last updated: Feb 2026
What is Pandas?
Pandas is a powerful data manipulation and analysis library for Python. It provides data structures for efficiently storing and manipulating large datasets, with tools for reading and writing data in various formats.
Key Data Structures
- Series: 1-dimensional labeled array
- DataFrame: 2-dimensional labeled data structure
- Panel: 3-dimensional labeled data structure
Creating DataFrames
Example
import pandas as pd
import numpy as np
# Create DataFrame from dictionary
data = {
'Name': ['Alice', 'Bob', 'Charlie', 'Diana'],
'Age': [25, 30, 35, 28],
'City': ['NYC', 'LA', 'Chicago', 'Boston'],
'Salary': [50000, 60000, 70000, 55000]
}
df = pd.DataFrame(data)
# Create DataFrame from list of lists
data_list = [
['Alice', 25, 'NYC', 50000],
['Bob', 30, 'LA', 60000],
['Charlie', 35, 'Chicago', 70000]
]
df2 = pd.DataFrame(data_list, columns=['Name', 'Age', 'City', 'Salary'])
print(df.head())Data Selection and Filtering
Example
# Select columns
print(df['Name'])
print(df[['Name', 'Age']])
# Filter data
young_people = df[df['Age'] < 30]
high_salary = df[df['Salary'] > 60000]
# Multiple conditions
filtered = df[(df['Age'] > 25) & (df['Salary'] > 55000)]
# Sort data
sorted_df = df.sort_values('Age', ascending=False)