Learn Python For Data Science (Course I)July 18, 2020 2020-08-04 10:39
Learn Python For Data Science (Course I)
- Welcome to Course I!
- Installing Python and Getting Started
- Data Types and Operations in Python
- Control Flow Tools in Python
- Errors and Exceptions in Python
- Classes and Objects in Python
- Standard Libraries in Python
- Virtual Environments and Packages in Python
- Working with files in Python
- End of Course
Standard Libraries in Python
This chapter gives you a basic overview of the different standard libraries of Python.
The Python Standard Library is a collection of script modules accessible to a Python program to simplify the programming process and removing the need to rewrite commonly used commands. They can be used by ‘calling/importing’ them at the beginning of a script. Generally, these standard libraries are installed alongside Python as packages by Python installers.
Here is a list of some of the standard libraries that are generally used in Python. Familiarity with these libraries is extremely helpful in repetitive tasks and commonly occurring problems.
- os module provides dozens of functions for interacting with the operating system.
- shutil module provides a higher-level interface on files and collections of files that is easier to use.
- glob module provides a function for making file lists from directory wildcard searches.
- argparse module provides a more sophisticated mechanism to process command-line arguments.
- re module provides regular expression tools for advanced string processing. For complex matching and manipulation, regular expressions offer succinct, optimized solutions.
- math module gives access to the underlying C library functions for floating-point math.
- random module provides tools for making random selections.
- statistics module calculates basic statistical properties (the mean, median, variance, etc.) of numeric data.
- datetime module supplies classes for manipulating dates and times in both simple and complex ways.
- Common data archiving and compression formats are directly supported by modules including: zlib, gzip, bz2, lzma, zipfile and tarfile.
- timeit module quickly demonstrates a modest performance advantage.
- doctest module provides a tool for scanning a module and validating tests embedded in a program’s docstrings.
- unittest module is not as effortless as the doctest module, but it allows a more comprehensive set of tests to be maintained in a separate file.
- reprlib module provides a version of repr() customized for abbreviated displays of large or deeply nested containers.
- pprint module offers more sophisticated control over printing both built-in and user-defined objects in a way that is readable by the interpreter.
- textwrap module formats paragraphs of text to fit a given screen width.
- threading module can run tasks in the background while the main program continues to run.
- decimal module offers a Decimal datatype for decimal floating-point arithmetic.
The libraries listed above are some of the libraries provided by Python. You can always refer to the official documentation to get a list of all the standard libraries in Python for different tasks.
In the upcoming chapter of this course, we will be discussing on how to set up a proper programming environment for importing and using libraries that are not a part of the Standard Library through Virtual Environments and Packages in Python.