Single logo
  • Courses
  • Blog
  • About
Join on SkoolJoin on Skool

In this topic

Machine Learning
  • Supervised Learning: Features, Labels, Classification and Regression
  • NumPy and pandas for AI Engineers: Arrays for Vectors, Tables for Logs
  • NumPy Arrays: Creation, Shape and Data Types From Scratch
  • NumPy Indexing, Slicing, Masks and np.where
  • NumPy Shapes: reshape, transpose, stack, concatenate and split
  • NumPy Universal Functions and Broadcasting, With the Shape Rule
  • NumPy Aggregation, Statistics and Sorting: sum, axis, percentile, argsort
  • Linear Algebra with NumPy: Dot Product, @, Determinant, Inverse and solve
  • Random Numbers in NumPy: default_rng, Seeds, Distributions and Sampling
  • Thinking in Arrays: A NumPy Student Performance Analysis
  • An Image Is a NumPy Array: Channels, Brightness, Grayscale, Invert and Crop
  • pandas Series and DataFrames: Your First Table, Inspected and Sorted
  • pandas Data IO: read_csv, to_csv, JSON, Excel and Parquet
  • pandas loc, iloc and Filtering: Label vs Position, Masks, query
  • Cleaning Messy Data in pandas: Missing Values, Duplicates, Types and Text
  • pandas groupby and merge: Split-Apply-Combine and Joining Tables
  • pandas Practice: Student Grades, Sales and an Employee Cleanup
  • First Look at a Dataset: 6 Checks Before You Plot or Model
  • Plotting Distributions with seaborn: Histograms, KDE, Counts and log1p
  • Scatter Plots and Pair Plots: See How Two Columns Relate
  • Finding Outliers: Box Plots, Violin Plots and the IQR Rule
  • Correlation and Heatmaps: Covariance, df.corr() and What They Miss
  • Train-Test Split and Data Leakage: Split First, Learn After
  • Handling Missing Data: Count the Blanks, Then Fill Them with SimpleImputer
  • Encoding Categorical Data: OrdinalEncoder, OneHotEncoder and LabelEncoder
  • Feature Scaling: StandardScaler, MinMaxScaler and Which Models Care
  • Pipelines and ColumnTransformer: All Preprocessing and the Model in One Object
  • Feature Selection and the Curse of Dimensionality: Keep the Columns That Matter
  • Project: Preprocess Rain in Australia from Raw CSV to Model-Ready Data
    Regression
    • Linear Regression and the Cost Function: Draw a Line, Score It
    • Gradient Descent Explained: Feel the Slope, Step Downhill
    • Linear Regression in scikit-learn: Fit, Predict and Read the Price Tags
    • Regression Metrics: MAE, RMSE, R-squared and the Baseline to Beat
    • Polynomial Regression, Overfitting and Underfitting: Bend the Line, Watch the Test Score
    • Regularisation with Ridge and Lasso: Put a Price on Big Weights
    Classification and Evaluation
    • Logistic Regression and the Sigmoid: Score, Squash, Decide
    • Logistic Regression in scikit-learn: predict, predict_proba and Softmax
    • Why Accuracy Lies: The Confusion Matrix, Baselines and Type I/II Errors
    • Precision, Recall and F1 Score: Two Questions and One Balance
    • ROC Curve, AUC and Choosing a Classification Threshold
    • Handling Imbalanced Data: class_weight, SMOTE and the Resampling Leak
    • Cross-Validation: KFold, StratifiedKFold, cross_val_score and cross_validate
    Classic Algorithms
    • K-Nearest Neighbours (KNN): Distance, k and Why Scaling Is a Must
    • Naive Bayes: Prior Times Likelihood, a Spam Filter by Hand and GaussianNB
    • Support Vector Machines (SVM): The Widest Road, C, Kernels and gamma
    • Decision Trees: Gini, max_depth and Feature Importances on Rain in Australia
    • Bagging and Random Forest: Many Shaky Trees, One Steady Answer
    • Boosting: Residuals by Hand, AdaBoost, Gradient Boosting and XGBoost
    • Voting and Stacking: Does a Team of Models Beat the Best One?
    Model Selection and Tuning
    • Hyperparameter Tuning with GridSearchCV and RandomizedSearchCV
    • Which Features Matter? Feature Importances, Permutation Importance and SHAP
    • Project: The Classification Master Template, from Raw CSV to a Saved Model
    • K-Means Clustering: Find Groups in Data With No Labels
    • Choosing k for K-Means: the Elbow Method and the Silhouette Score
    • Hierarchical Clustering and DBSCAN: Dendrograms, Linkage, eps and Noise
    • Dimensionality Reduction with PCA: 13 Columns Down to 2
    • Association Rules and Market Basket Analysis: Support, Confidence, Lift and Apriori
    • Recommender Systems: Item-Based Collaborative Filtering with Cosine Similarity
    • Bag of Words with CountVectorizer: Turn Text into Word Counts
    • TF-IDF with TfidfVectorizer: Common Words Fade, Rare Words Speak
    • Build a Text Classifier with TF-IDF and a Pipeline: Naive Bayes vs LinearSVC
    • Why Neural Networks: Pixels, One Neuron and Layers
    • The Forward Pass and Activation Functions: ReLU, Sigmoid, Tanh and Softmax
    • Loss and Backpropagation: How Wrong, and Who Is to Blame
    • The Training Loop: Epochs, Mini-Batches, Learning Rate and Optimisers
    • Your First Neural Network with Keras: MNIST Digits at 97.7%
    • The Same Network in PyTorch: DataLoader, nn.Module and the Five-Line Training Loop
    • Convolutional Neural Networks (CNN) Basics: Filters, Feature Maps and Pooling
    • Embeddings: Words as Vectors, Cosine Similarity and nn.Embedding
    • Similarity Search: Finding the Closest Vectors with NumPy and NearestNeighbors
    • Dropout, Early Stopping and Batch Norm: Judge Each One by the Validation Curve
    • Transfer Learning on Images: A Frozen ResNet-18, a Small Head and an Honest Baseline
    • Attention Explained Without the Maths: Query, Key, Value and the Word "it"
    • Transformer Building Blocks in PyTorch: Follow the Shapes Through Attention and a Block
    • Pretrained Models from Hugging Face: A Sentiment Pipeline and Sentence Embeddings on a CPU
    • Loading a Language Model and Running Inference: Download, Load, Tokenize, Generate
    • Model Size and Memory: Parameters x Bytes, Quantization, and Where to Run a Model
    • Training on a GPU: Mixed Precision, Gradient Accumulation and Checkpoints That Really Resume
    • When NOT to Fine-Tune: A Decision Tree of Prompt, RAG, Tools, Then Fine-Tuning
    • Full Fine-Tuning vs LoRA vs QLoRA: What Each One Changes and What It Costs
    • LoRA Fine-Tune of a Tiny Model: Teach SmolLM2-135M Your House Style on a CPU
    • Knowledge Distillation: Teach a Model 100 Times Smaller From a Teacher's Soft Labels
    • Serving Open Models: Continuous Batching, vLLM and Cold Starts
      Engineering Basics
      • Python Virtual Environments: One Project, One Toolbox
      • Git and GitHub Fundamentals: Commits, Branches, Push and Pull
      • Testing a FastAPI App with pytest: Three Small Tests
      • Config and Logging Instead of Hard-Coded Values in ML Training
      • SQL Essentials for Python: SELECT, WHERE, JOIN and GROUP BY
      Data and Features in Production
      • Time Splits and Group Splits: Make the Split Match How the Model Is Used
      • Time Series Basics: Lags, Rolling Windows and Walk-Forward Backtesting
      • Feature Engineering Patterns, Each One Tested: Date Parts, Differences, Windows and Target Encoding
      • Point-in-Time Correctness: Join Features as of Each Event with merge_asof
      • Data Validation and Schema Checks: Stop Bad Input Before It Reaches the Model
      • Training-Serving Skew: Same Model, Different Inputs, and How to Detect It
      • Feature Stores: Offline and Online Stores, and When You Actually Need One
      • Data Versioning with DVC: Tie Every Model to the Exact Data That Trained It
      Experiments and Model Quality
      • MLOps in One Picture: Code, Data, Model and the Lifecycle Loop
      • Experiment Tracking with MLflow: Log Params, Metrics and the Model, Then Compare Runs
      • MLflow Model Registry Aliases: Serve the Champion, Ship a New Version and Roll Back in One Line
      • The Cost of Being Wrong: Baselines, a Price per Mistake and the Cheapest Threshold
      • Probability Calibration: Can You Trust the 0.8? Reliability Curves, Platt and Isotonic
      • Slice Evaluation and Fairness Checks: Score the Model Group by Group
      Serving Models
      • Saving and Loading Models with joblib: One Pipeline, One File
      • FastAPI Hello World: Routes, uvicorn and the Free Swagger Page
      • Deploy a Machine Learning Model with FastAPI: POST /predict for a Saved Model
      • Docker Essentials for ML: Images, Containers and Volumes with a Model API
      • Containerising a Model API: A Dockerfile for FastAPI and scikit-learn, Line by Line
      • Online, Batch or Streaming? Picking the Serving Pattern for an ML Model
      • A Production FastAPI for an ML Model: Input Limits, /health, /ready and a Model Version
      • Batch Scoring a Million Rows: Chunks, a Run ID and a Safe Rerun
      • Latency Math: p50, p95, p99 and Why the Tail Reaches Your Users
      • Measuring Latency of an ML API: Timing Inside with OpenTelemetry, Outside with a Load Test and Locust
      • Making ML Inference Fast: ONNX, Micro-Batching and Quantisation, Measured
      • Sizing and Autoscaling an Inference Service: From One Replica to a Replica Count
      • Docker Compose: Run a FastAPI App and Postgres From One File
      • Docker Health Checks, Networks and Resource Limits: Up Is Not Enough
      Pipelines, CI/CD and Cloud
      • The Training Pipeline as a DAG: Steps, Files, Retries and a Safe Rerun
      • Orchestrating ML Pipelines with Airflow: Schedule, Retries and Backfill
      • Retries and Backoff for Reliable Tasks: Retry What Heals, Wait Longer, Add Jitter, Set Limits
      • CI with GitHub Actions: Run the Tests and Build the Docker Image on Every Push
      • CI/CD for ML: A Quality Gate That Blocks a Weaker Model, Even When Every Test Passes
      • Which Cloud for What: AWS, Azure, Google Cloud, GPU Clouds, Edge and Platforms
      • IaaS, PaaS, Containers or Serverless? Choosing Where a Model API Runs
      • Kubernetes at a High Level: Pods, a Deployment and a Service for a Model API
      • Managed ML Platforms: What SageMaker, Vertex AI and Azure ML Give You, and Tie You To
      • Deploying a Model API to AWS: ECR, Secrets Manager, CloudWatch and Fargate, Then Teardown
      • Cloud Cost Thinking for ML: Size x Count x Hours x Rate, and Three Decisions Worth Ten Times
      • Terraform Modules, Remote State and Environments: One Codebase for Staging and Production
      Monitoring and Release
      • Monitoring Drift and Retraining: When a Model Gets Worse With No Code Change
      • Drift Detection in Code: PSI Bin by Bin, the KS Test, Evidently and a Measured Threshold
      • Shadow, Canary and Rollback: Releasing a New Model Without Betting Everything on It
      • A/B Tests for Models: Did the New Model Make Things Better for People?
      • When Labels Arrive Weeks Late: What to Watch Before You Can Grade the Model
      • Retraining Triggers: Schedule, Drift and Performance, Wired to One Retrain Pipeline
      • The User Feedback Loop: Why Thumbs Up Isn't the Truth, and What a Small Random Review Adds
      • Debugging a Model in Production: A Four-Step Runbook, Cheap Checks First
      • Project: Car Price Predictor End to End, from CSV to a FastAPI Price API
      • Fraud Scoring, Part 1: The Problem, the Metric and the Baseline
      • Fraud Scoring, Part 2: Training With Time Splits, Leak-Free Features and a Cost-Picked Threshold
      • Fraud Scoring, Part 3: Serving It With FastAPI, Docker and a 50 ms Budget
      • Fraud Scoring, Part 4: Release and Monitoring With Shadow, Drift and Late Labels
      • Demand Forecasting, Part 1: The Business Problem, a Price per Mistake and the Line to Beat
      • Recommendations, Part 1: Two Stages, Candidates Then Ranking
      • Demand Forecasting, Part 2: Walk-Forward Backtesting, Ridge vs Boosting and the Slices an Average Hides
      • Recommendations, Part 2: Candidate Generation With Embeddings
      • Demand Forecasting, Part 3: The Nightly Batch Pipeline That Survives a Crash
      • Recommendations, Part 3: The Ranker and Offline Metrics (Recall@k and nDCG)
      • Demand Forecasting, Part 4: Serving the Forecasts, the Outcome Join and a Retrain Rule
      • Recommendations, Part 4: Serving With FastAPI, a Cache and a Popular Fallback
      • Ticket Routing, Part 1: A Safe Split, Keyword Rules and a TF-IDF Baseline
      • Ticket Routing, Part 2: Fine-Tuning a Small Encoder on a CPU, With a Run Log and Honest Ranges
      • Ticket Routing, Part 3: Quantise to int8, Host Behind FastAPI and Measure the Server
      • Ticket Routing, Part 4: Canary, Automatic Rollback and "Does Your Small Model Reason?"
      • The ML Engineer Interview Loop: Five Rounds, What Each One Looks For, and a Simple Rubric
      • The Answer Framework for Technical Interviews: Five Moves, Scored Out of 24
      • From Symptom to Pattern: How to Answer "Which Pattern Would You Use?" in an Interview
      • The ML System Design Framework: Eight Steps, in Order, on a Spam Filter
      • ML System Design Interview: Fraud Detection for Card Payments, in Eight Steps with Numbers
      • ML System Design Interview: A Recommendation Feed, From a Score to Beat to Online Guardrails
      • ML System Design Interview: Ad Click Prediction, Sparse Features, Calibration and Late Clicks
      • Interview Answer: How Do You Roll Out a New Model Safely When True Labels Come Weeks Later?
      • Mock ML Engineer Interview, Scored: A Rollout Question Where the Labels Arrive Weeks Late
      • The ML Coding Round: K-Means, Logistic Regression and a Top-k Metric From Scratch
      • The ML Depth Round: Five Questions That Always Come, in Thirty Seconds Each
      • Presenting Your Portfolio: A Six-Section README That Shows Evidence, Not Buzzwords
      • Reading a Job Ad and Shaping Your CV: A Gap List and CV Lines You Can Stand Behind
      • How AI Questions Show Up in an ML Engineer Interview: Your Angle, the Rounds and a Good Answer
      • Design a Multi-Tenant RAG Assistant, Part 1: Requirements, Rough Numbers and a Contract
      • Design a Multi-Tenant RAG Assistant, Part 2: Tenant Isolation, a Scoped Cache and Walking an Outage
      • A 500 MB PDF Takes 50 s to Answer, Get It to 2 s: Measure First, Then Promise Per Path
      • A 500 MB PDF From 50 s to 2 s, the Fast Path: Queue, Status, Streaming and an Acceptance Test That Fails
      • Coding Round: Merge Top-k From Sorted Shards, Then Fuse Two Rankings by Place
      • Mock Interview, Scored: 429s at Peak Because One Customer's Batch Job Eats the Capacity
      • One Request Through Every Pattern: a Map of 25 AI System Design Patterns, Stop by Stop
      • AI Engineer, ML Engineer, FDE: What Each Interview Tests, and the Trap of Answering for the Wrong Room
      • Mock Interview: Layer the Guardrails on a Refund Agent, Scored From 6 to 20 of 24
      • Mock Interview for a Forward Deployed Engineer: a Private RAG Assistant in One Region, Scored From 4 to 30 of 36
      • The Coding Round in One Picture: Twenty Minutes, Small, Correct, Tested and Said Out Loud
      • Your AI Interview Preparation Roadmap by Track: AI Engineer, ML Engineer and FDE, Plus the Final Week
      1. Blog
      2. /
      3. Machine Learning
      4. /
      5. Foundations

      pandas Series and DataFrames: Your First Table, Inspected and Sorted

      A Series is one labelled column; a DataFrame is columns sharing an index. Build both, inspect them with info and describe, select and add columns, sort rows, and see copy-on-write in pandas 3.

      Chaand Sheikh

      ·27 November 2026·Updated 28 November 2026Foundations

      What you will learn

      • Create a Series and a DataFrame and explain how they fit together
      • Inspect a table with shape, dtypes, head, tail, info and describe
      • Select columns, add a column with a rule, and compute sums and means
      • Sort rows with sort_values and understand copy-on-write in current pandas

      Before you start

      • Python lists and dictionaries
      • NumPy arrays and dtypes

      NumPy gave you fast numbers, but those numbers had no names on them. pandas adds the names, so every value sits under a column and beside a row label. That's why people reach for it whenever data looks like a table.

      Think of a spreadsheet. Take one column of scores: each value has a row label beside it, and pandas calls that a Series. Now slide a few more columns next to it, all lined up on the same row labels. That's a DataFrame: columns sharing an index. The index is just pandas' word for the row labels.

      You install the library once with pip install pandas and import it as pd. Outputs below are from pandas 3.1.1.

      A Series is one labelled column; a DataFrame is columns sharing an index Series 012859278indexvalues Name: score, dtype: int64 DataFrame, shape (3, 3) nameagescore 012 AliceBobCharlie 253035 859278 df["score"] is a Series with the same index
      Every column of a DataFrame is a Series, and they all share one index.

      Your first Series

      import pandas as pd
      
      s1 = pd.Series([10, 20, 30])
      
      print(s1)
      print(type(s1))
      0    10
      1    20
      2    30
      dtype: int64
      <class 'pandas.Series'>

      You didn't give labels, so pandas numbers the rows itself: 0, 1, 2. dtype is the type of the values, here whole numbers. It's more than a list: it's a column that knows its labels.

      s2 = pd.Series({"a": 100, "b": 200, "c": 300})
      
      print(s2)
      print(s2.index.to_list())
      print(s2.values)
      print(s2.dtype)
      print(s2["b"])
      a    100
      b    200
      c    300
      dtype: int64
      ['a', 'b', 'c']
      [100 200 300]
      int64
      200

      Pass a dictionary and the keys become the labels. .values prints with no commas because it's a NumPy array underneath. And you look a value up by its label, just like a dictionary.

      Your first DataFrame

      import pandas as pd
      
      data = {
          "name": ["Alice", "Bob", "Charlie"],
          "age": [25, 30, 35],
          "score": [85, 92, 78],
      }
      df = pd.DataFrame(data)
      
      print(df)
      print(df.shape)
      print(df.columns.to_list())
      print(df.index.to_list())
            name  age  score
      0    Alice   25     85
      1      Bob   30     92
      2  Charlie   35     78
      (3, 3)
      ['name', 'age', 'score']
      [0, 1, 2]

      Each key is a column name and each list is that column's values. The three lists stand up as three columns on one shared index, so row 1 means Bob, 30 and 92 together. shape is rows then columns, with no brackets after it, because it's a stored value, not a method.

      Pull one column out with df["score"] and you get a Series that keeps the labels and carries the column's name:

      0    85
      1    92
      2    78
      Name: score, dtype: int64

      So everything you learned about a Series works on any column.

      Each column has a type

      df = pd.DataFrame({
          "name": ["Alice", "Bob", "Charlie"],
          "age": [25, 30, 35],
          "score": [85.5, 92.0, 78.25],
      })
      
      print(df.dtypes)
      print(df["name"].dtype)
      print(df["age"].dtype)
      name         str
      age        int64
      score    float64
      dtype: object
      str
      int64

      str is how current pandas marks a text column. Older tutorials show object there, so don't let that throw you. The dtype: object on the last line of the first print is something else: df.dtypes is itself a Series whose values are types, and that line describes the printout, not your columns. dtypes with an s is for the whole table, dtype is for one column.

      A first look at any table

      df = pd.DataFrame({
          "name": ["Alice", "Bob", "Charlie", "Diana", "Evan"],
          "age": [25, 30, 35, 28, 41],
          "score": [85, 92, 78, 88, 95],
      })
      
      print(df.head(2))
      print(df.tail(2))
      df.info()
          name  age  score
      0  Alice   25     85
      1    Bob   30     92
          name  age  score
      3  Diana   28     88
      4   Evan   41     95
      <class 'pandas.DataFrame'>
      RangeIndex: 5 entries, 0 to 4
      Data columns (total 3 columns):
       #   Column  Non-Null Count  Dtype
      ---  ------  --------------  -----
       0   name    5 non-null      str
       1   age     5 non-null      int64
       2   score   5 non-null      int64
      dtypes: int64(2), str(1)
      memory usage: 252.0 bytes

      head and tail show a sample (five rows if you leave the number out), and the rows keep their labels. info() prints by itself, so there's no print around it. It gives the size, then one line per column with its count of filled cells and its type. Run it first on any new table.

      describe in one line

      On the three-row Alice, Bob, Charlie table:

      print(df.describe())
              age  score
      count   3.0    3.0
      mean   30.0   85.0
      std     5.0    7.0
      min    25.0   78.0
      
      25%    27.5   81.5
      
      50%    30.0   85.0
      
      75%    32.5   88.5
      max    35.0   92.0

      Only the number columns appear; name is text, so it's left out. std says how far values sit from the mean. The percent rows are cut points: 50% is the middle value, and 25% is a quarter of the way up. One line gives you a feel for every number column.

      Selecting columns, and two small traps

      print(df["name"])
      print(df.name)
      print(df[["name", "score"]])
      0      Alice
      1        Bob
      2    Charlie
      Name: name, dtype: str
      0      Alice
      1        Bob
      2    Charlie
      Name: name, dtype: str
            name  score
      0    Alice     85
      1      Bob     92
      2  Charlie     78

      One name gives a Series. A list of names (note the double brackets) gives a smaller DataFrame.

      Ask for a column that doesn't exist, like df["salary"], and pandas raises KeyError: 'salary'. Check your spelling against df.columns. The second trap is a column whose name clashes with a method:

      df = pd.DataFrame({
          "name": ["Alice", "Bob"],
          "count": [3, 4],
      })
      
      print(df["count"])
      print(df.count)
      0    3
      1    4
      Name: count, dtype: int64
      <bound method DataFrame.count of     name  count
      0  Alice      3
      1    Bob      4>

      A DataFrame already has a count method, and the method wins. The dot is handy for quick work, but square brackets always mean a column.

      Adding a column, sums and means

      df = pd.DataFrame({
          "name": ["Alice", "Bob", "Charlie"],
          "score": [85, 92, 78],
      })
      
      df["passed"] = df["score"] > 80
      df["bonus"] = df["score"] + 5
      
      print(df)
      print(df.columns.to_list())
            name  score  passed  bonus
      0    Alice     85    True     90
      1      Bob     92    True     97
      2  Charlie     78   False     83
      ['name', 'score', 'passed', 'bonus']

      Adding a column is just an assignment. You write the rule once, and pandas runs it down the whole column with no loop. To remove one, df.drop(columns="bonus") gives you a table without it.

      df = pd.DataFrame({
          "name": ["Alice", "Bob", "Charlie"],
          "age": [25, 30, 35],
          "score": [85, 92, 78],
      })
      
      print(df["score"].sum())
      print(df["score"].mean())
      print(df["score"].max())
      print(df[["age", "score"]].mean())
      255
      85.0
      92
      age      30.0
      score    85.0
      dtype: float64

      Select first, then calculate. On several columns, mean works column by column and returns a Series labelled by column name.

      Sorting rows

      df = pd.DataFrame({
          "name": ["Alice", "Bob", "Charlie"],
          "score": [85, 92, 78],
      })
      
      print(df.sort_values("score"))
      print(df.sort_values("score", ascending=False))
      print(df)
            name  score
      2  Charlie     78
      0    Alice     85
      1      Bob     92
            name  score
      1      Bob     92
      0    Alice     85
      2  Charlie     78
            name  score
      0    Alice     85
      1      Bob     92
      2  Charlie     78

      Look at the labels: 2, 0, 1. They travel with their rows, so each row stays whole. And df itself is still in the old order. sort_values gives you a new table; assign it to a variable if you want to keep it.

      Copy-on-write

      df = pd.DataFrame({
          "name": ["Alice", "Bob", "Charlie"],
          "score": [85, 92, 78],
      })
      
      scores = df["score"]
      scores[0] = 0
      
      print(scores.to_list())
      print(df["score"].to_list())
      [0, 92, 78]
      [85, 92, 78]

      The table didn't change. This is copy-on-write: the two share their data until one of them writes, and then that one gets its own copy. Older tutorials may show the table changing here, so trust what your version prints. To change the table itself, assign to it directly, the same way you added a column. (NumPy behaves differently: there a slice is a view. See NumPy indexing and slicing.)

      Recap

      TaskCode
      One labelled columnpd.Series(list_or_dict)
      A tablepd.DataFrame(dict_of_lists)
      Inspectshape, dtypes, head(), tail(), info(), describe()
      Selectdf["col"] (Series), df[["a", "b"]] (DataFrame)
      Add a columndf["new"] = rule
      Calculatedf["col"].sum(), .mean(), .max()
      Sortdf.sort_values("col", ascending=False) returns a new table

      Try it yourself: in the lesson's practice.py, a small shop table has item, price and qty for a pen, book, bag and cup. Add a total column (price times quantity), sort it biggest first, and check that the totals add up to 116. Or ask an AI tool to write it, then read every line.

      Next: reading and writing CSV, Excel and JSON. For the one-pass version aimed at AI engineers, see NumPy and pandas for AI Engineers.

      Keep going in Machine Learning · 12 of 179

      Previous
      An Image Is a NumPy Array: Channels, Brightness, Grayscale, Invert and Crop
      Next post
      pandas Data IO: read_csv, to_csv, JSON, Excel and Parquet
      Community · Free to join
      Single logo

      StudyEasy AI Community

      Hosted onSkool

      Learn AI engineering, share what you build, and connect with other learners.

      • Free resources: lesson files, notebooks and code

      • Ask questions and join engineering discussions

      • Meet real people learning and building with AI

      Join free on Skool

      Related course on Udemy

      The Python Architect Masterclass: Full Stack to AI Engineer

      Python, Django, FastAPI, React, Docker, AWS, LLMs, RAG, agents and MCP, from first steps to AI engineer.View on Udemy ↗: The Python Architect Masterclass: Full Stack to AI Engineer (paid course, opens in a new tab)

      Related posts

      Supervised Learning: Features, Labels, Classification and Regression

      What supervised learning is, shown on one small job: sorting support tickets into billing and technical. Rules vs learning from examples, classification vs regression, why some tickets stay hidden, and a 12-ticket classifier that labels three new ones.

      NumPy and pandas for AI Engineers: Arrays for Vectors, Tables for Logs

      NumPy and pandas at the depth an AI engineer needs. Shape, axis and broadcasting on 1,000 sample embeddings, a loop against one @, then a 2,000-row model call log: dtypes on load, missing values, filters, groupby model, merge and resample.

      NumPy Arrays: Creation, Shape and Data Types From Scratch

      Why a NumPy array beats a list for numbers, the seven ways to create one, what shape, ndim, size and dtype tell you, and why a slice is a view. Every output is from a real run on NumPy 2.

      NumPy Indexing, Slicing, Masks and np.where

      Get values out of a NumPy array by position, by range, by condition and by a list of positions, write through slices, use np.where three ways, and learn which picks are views and which are copies.

      On this page

      • Your first Series
      • Your first DataFrame
      • Each column has a type
      • A first look at any table
      • describe in one line
      • Selecting columns, and two small traps
      • Adding a column, sums and means
      • Sorting rows
      • Copy-on-write
      • Recap
      Community · Free to join
      Single logo

      StudyEasy AI Community

      Hosted onSkool

      Learn AI engineering, share what you build, and connect with other learners.

      • Free resources: lesson files, notebooks and code

      • Ask questions and join engineering discussions

      • Meet real people learning and building with AI

      Join free on Skool

      Related course on Udemy

      The Python Architect Masterclass: Full Stack to AI Engineer

      Python, Django, FastAPI, React, Docker, AWS, LLMs, RAG, agents and MCP, from first steps to AI engineer.View on Udemy ↗: The Python Architect Masterclass: Full Stack to AI Engineer (paid course, opens in a new tab)

      Single logo

      Empowering Education, One Course at a Time

      About
      About usContact us
      Legal
      Terms of UsePrivacy Policy

      © 2026 StudyEasy Organization. All rights reserved.