101.school
CoursesAbout
Search...⌘K
Generate a course with AI...

    Python

    Receive aemail containing the next unit.
    • Refreshing Python Basics
      • 1.1Python Data Structures
      • 1.2Syntax and Semantics
      • 1.3Conditionals and Loops
    • Introduction to Object-Oriented Programming
      • 2.1Understanding Class and Objects
      • 2.2Design Patterns
      • 2.3Inheritance, Encapsulation, and Polymorphism
    • Python Libraries
      • 3.1Numpy and Matplotlib
      • 3.2Pandas and Seaborn
      • 3.3SciPy
    • Handling Files and Exception
      • 4.1Reading, writing and manipulating files
      • 4.2Introduction to Exceptions
      • 4.3Handling and raising Exceptions
    • Regular Expressions
      • 5.1Introduction to Regular Expressions
      • 5.2Python’s re module
      • 5.3Pattern Matching, Substitution, and Parsing
    • Databases and SQL
      • 6.1Introduction to Databases
      • 6.2Python and SQLite
      • 6.3Presentation of Data
    • Web Scraping with Python
      • 7.1Basics of HTML
      • 7.2Introduction to Beautiful Soup
      • 7.3Web Scraping Case Study
    • Python for Data Analysis
      • 8.1Data cleaning, Transformation, and Analysis using Pandas
      • 8.2Data visualization using Matplotlib and Seaborn
      • 8.3Real-world Data Analysis scenarios
    • Python for Machine Learning
      • 9.1Introduction to Machine Learning with Python
      • 9.2Scikit-learn basics
      • 9.3Supervised and Unsupervised Learning
    • Python for Deep Learning
      • 10.1Introduction to Neural Networks and TensorFlow
      • 10.2Deep Learning with Python
      • 10.3Real-world Deep Learning Applications
    • Advanced Python Concepts
      • 11.1Generators and Iterators
      • 11.2Decorators and Closures
      • 11.3Multithreading and Multiprocessing
    • Advanced Python Concepts
      • 12.1Generators and Iterators
      • 12.2Decorators and Closures
      • 12.3Multithreading and Multiprocessing
    • Python Project
      • 13.1Project Kick-off
      • 13.2Mentor Session
      • 13.3Project Presentation

    Python Libraries

    Understanding Numpy and Matplotlib

    general-purpose programming language

    General-purpose programming language.

    Python is a powerful language for data analysis, largely due to its extensive ecosystem of libraries. Two of the most fundamental libraries for data analysis and visualization are Numpy and Matplotlib. This article will provide an overview of these libraries and their capabilities.

    Numpy

    Numpy, short for Numerical Python, is a library for the Python programming language, adding support for large, multi-dimensional arrays and matrices, along with a large collection of high-level mathematical functions to operate on these arrays.

    Understanding Numpy Arrays

    At the core of the Numpy package, is the ndarray object. This encapsulates n-dimensional arrays of homogeneous data types, with many operations being performed in compiled code for performance. Numpy arrays have a fixed size at creation, unlike Python lists (which can grow dynamically). Changing the size of an ndarray will create a new array and delete the original.

    Array Operations and Manipulations

    Numpy provides a host of operations you can perform with and on arrays. You can reshape an array, compute the transpose of an array, find the index of elements, etc. Arithmetic operations on arrays are element-wise operations. For example, multiplication of two arrays results in an array that is the element-wise multiplication of the elements.

    Mathematical Functions in Numpy

    Numpy provides a large set of numeric datatypes that you can use to construct arrays. Numpy tries to guess a datatype when you create an array, but functions that construct arrays usually also include an optional argument to explicitly specify the datatype.

    Matplotlib

    Matplotlib is a plotting library for the Python programming language and its numerical mathematics extension Numpy. It provides an object-oriented API for embedding plots into applications using general-purpose GUI toolkits like Tkinter, wxPython, Qt, or GTK.

    Basic Plotting with Matplotlib

    Matplotlib's pyplot submodule provides the plot() function which is frequently used to plot lines and markers to a figure. The show() function is used to display the figure to the user. The figure() function in the pyplot module of matplotlib is used to create a new figure.

    Customizing Plots

    Matplotlib allows you to adjust every aspect of your plot. You can change the line width, line style, marker style, font size, font style, text color, etc. You can also add labels to the x-axis and y-axis and add a title to the plot.

    Multiple Plots and Subplots

    Matplotlib's pyplot submodule provides functions to generate multiple plots and subplots in the same figure. The subplot() function is used to add multiple plots in one figure. The subplots() function in pyplot module of matplotlib library is used to create a figure and a set of subplots.

    By the end of this unit, you should have a solid understanding of how to manipulate arrays using Numpy and how to create and customize plots using Matplotlib. These skills are fundamental to any data analysis task in Python.

    Test me
    Practical exercise
    Further reading

    Buenos dias, any questions for me?

    Sign in to chat
    Next up: Pandas and Seaborn