TensorLearn
Back to Course
Data Intelligence: NumPy & Pandas
Module 15 of 15

11. The Cheatsheet

NumPy

python
import numpy as np a = np.array([1, 2, 3]) a.shape # (3,) a.dtype # int64 np.zeros((3,3)) # 3x3 Matrix of 0s a[a > 2] # [3] (Boolean Mask)

Pandas Setup

python
import pandas as pd df = pd.read_csv('data.csv', parse_dates=['date']) df.info() # RAM usage & Types df.describe() # Statistics

Selection

python
df['col'] # Series df[['a', 'b']] # DataFrame df.loc[row_label] # By Label df.iloc[row_idx] # By Position

Cleaning

python
df.drop_duplicates() df.fillna(method='ffill') df['a'] = df['a'].astype('category')

Aggregation

python
df.groupby('col').mean() df.pivot_table(index='a', columns='b', values='c')

Mark as Completed

TensorLearn - AI Engineering for Professionals