MCS-201 · Unit 9

Introduction to Python

Section 5 of 7

Block 3 · Unit 9Introduction to Python9 min · Section 5 of 7

9.5Popular Python Libraries and Frameworks

Covers IGNOU MCS-201 §9.4

The study material introduces a long list of libraries. You do not need to learn to use them now, but you should know what each is for, so you can name the right tool for a task. This section groups them by area.

Machine learning and deep learning

LibraryPurposeNotes
scikit-learnClassical machine learning: classification, regression, clustering (k-means, random forests, support vector machines, DBSCAN)Built on NumPy and SciPy; supports supervised and unsupervised learning
TensorFlowEnd-to-end platform for building and deploying neural networksDeveloped by Google; C++ core with a Python interface
KerasHigh-level, beginner-friendly interface for building neural networksSince Keras 3 it can run on TensorFlow, PyTorch or JAX
PyTorchDeep learning with tensors and automatic differentiation, on CPU or GPUDeveloped by Meta; widely used in research and production
TheanoDefines and optimises mathematical expressions on arrays, on CPU or GPUHistorically important; development ended in 2017 (continued as PyTensor)

A tensor is a multi-dimensional array of numbers: a single number, a list, a table, or higher-dimensional data such as a batch of colour images.

Scientific computing and data science

LibraryPurpose
NumPyFast n-dimensional arrays, linear algebra, Fourier transforms, random numbers; the foundation of most scientific Python
SciPyBuilt on NumPy: integration, optimisation, statistics, signal processing
pandasTables of data (DataFrames): reading CSV, Excel, SQL and JSON, cleaning, grouping and summarising
Matplotlib2D plots: line, bar, histogram, scatter
SeabornStatistical plots (heat maps, violin plots) built on Matplotlib, with an easier interface

Web, mobile, games and scraping

ToolAreaPurpose
DjangoWebFull-featured framework for database-driven sites: ORM, admin panel, authentication
FlaskWebLightweight framework; you add only what you need
KivyMobile/desktopCross-platform GUI apps for Windows, Linux, macOS, Android and iOS
BeeWareMobile/desktopTools to build apps with native-looking interfaces on each platform
PygameGames2D games and multimedia: graphics, sound, input
ScrapyWeb scrapingFramework for building crawlers (“spiders”) that extract structured data from websites
MicroPythonEmbeddedPython 3 for microcontrollers, with modules for pins, timers and sensors

Key takeaways

  • ML: scikit-learn (classical), TensorFlow, PyTorch, Keras (deep learning); Theano is discontinued.
  • Data: NumPy, SciPy, pandas; plots: Matplotlib, Seaborn.
  • Web: Django, Flask; apps: Kivy, BeeWare; games: Pygame; scraping: Scrapy; embedded: MicroPython.
  • These are third-party packages, installed with pip (or included in Anaconda and Colab).

Practice questions

Answer on paper first, then check. The explanation matters more than the letter you chose.

Question 1 · multiple choice

Which library provides DataFrames for working with tables of data?

Show answer

Answer: B. pandas

pandas’ DataFrame is a table with labelled rows and columns; NumPy provides unlabelled numerical arrays.

Question 2 · multiple choice

Which library is mainly used to draw charts such as histograms and scatter plots?

Show answer

Answer: C. Matplotlib

Matplotlib is the standard plotting library; Seaborn adds statistical plots on top of it.

Question 3 · multiple choice

What does this program print? (NumPy is installed.)

Python · quiz_numpy.py
import numpy as np
a = np.array([2, 4, 6])
print((a * 3).tolist(), int(a.sum()))
Show answer

Answer: B. [6, 12, 18] 12

Multiplying an array multiplies every element; the sum of the original array is 12. Multiplying a list by 3 would repeat it three times instead.

Question 4 · multiple choice

Which library would you choose for classical machine learning tasks such as k-means clustering on a small dataset?

Show answer

Answer: D. scikit-learn

scikit-learn provides ready-made classical algorithms, including k-means, random forests and support vector machines.

Question 5 · multiple choice

What is the current status of Theano?

Show answer

Answer: A. Its original development ended in 2017; it continues as forks such as PyTensor

Theano was influential but its original team stopped developing it in 2017.

Question 6 · short answer

Explain what Kivy and Django are used for, and why one could be called a framework.

Show worked answer

Kivy is used to build graphical applications that run on desktop and mobile platforms (Windows, macOS, Linux, Android, iOS) from one Python code base. Django is used to build database-driven websites, providing an ORM for the database, URL routing, templates, an admin interface and user authentication. Both are frameworks: you write pieces such as screens, event handlers or view functions, and the framework runs the application and calls your code when events or web requests occur.

↑ ↓ move↵ openTab switch type