Pandas Methods with Examples
### 1. Data Creation
```python
import pandas as pd
# Create DataFrame
data = {'Name': ['Alice', 'Bob', 'Charlie'], 'Age': [25, 30, 35]}
df = pd.DataFrame(data)
# Create Series
s = pd.Series([1, 2, 3], index=['a', 'b', 'c'])
# Read CSV (example assumes 'data.csv' exists)
df_csv = pd.read_csv('data.csv')
print(df)
print(s)
```
### 2. Viewing and Inspecting Data
```python
print(df.head()) # First 5 rows
print(df.info()) # Summary of DataFrame
print(df.describe()) # Statistics of numeric columns
print(df.shape) # (rows, columns)
print(df.columns) # Column names
```
### 3. Indexing and Selection
```python
# Access using loc and iloc
print(df.loc[0, 'Name']) # Label-based
print(df.iloc[0, 0]) # Position-based
# Subsetting
print(df[['Name', 'Age']]) # Select columns
print(df[df['Age'] > 28]) # Filter rows
```