- Introduction
- String Module
- Statistics Module
- Random Module
- Time Module
- Shutil Module
- CSV Module
- Datetime
- Math Module
- Pytz Module
- Pyshorteners Module
- Requests Library
I've studied these libraries & modules during learning proceedure of Python. This file contains a short explanation, pip install and a link of the Python library & module. It only includes functions-methods for each library that i've used in PyLearn-Excercises. I tried to avoid the most common and well known modules like numpy, pandas etc.
- Provides common string operations. A collection of string constants.
- To import "import string"
- Pip Install: pip install strings
- String Module Documentation
- 🔻STRING Functions i've used:
- string.digits(): Output: 0123456789.
- string.ascii_uppercase(): Output: ABCDEFGHIJKLMNOPQRSTUVWXYZ.
- Mathematical statistics functions. Functions for calculating mathematical statistics.
- To import "import statistics"
- Pip Install: pip install statistics
- Statistics Module Documentation
- 🔻STATISTICS functions i've used:
- fmean(): median of float numbers.
- mean(): median of integer numbers.
- mode(): the most occuring value.
- multimode(): the most occuring 2 vlues.
- The random module in Python provides functions for generating random numbers.
- To import "import random"
- Pip Install: pip install random
- Random Module Documentation
- 🔻RANDOM functions i've used:
- random.randit(): generate a random integer.
- random.random(): generates a random float num between 0-1.
- random.choice(): chooses a random element from a list.
- random.choices():random.choices(population, weights=None, k=1)
- random.shuffle(): shuffles the list randomly.
- random.sample():picks random element from an iterable without replacement.
- Time module provides time related functions.
- To import "import time"
- Pip install: pip install TIME-python
- Time Module Documentation
- 🔻TIME functions i've used:
- time.sleep(): stops execution for the given number of seconds.
- perf_counter():counts the time of a working proceedure- start, end
- Shutil modeule offers copying, removing functions for files.
- To import "import shutil"
- Pip install: pip install shutil
- Shutil Module Documentation
- 🔻Shutil functions i've used:
- shutil.copy(): copies the source file or directory.
- shutil.rmtree(path): deletes a directory containing files.
- Os.path module has useful functions on pathnames.
- To import "import os"
- pip install: pip install os
- OS.PATH Documentation
- 🔻os.path functions that i've used:
- os.path.exists(): this checks if the named file exists on the given path .
- os.path.basename(path): extracts the file name without extenstion from a path.
- os.path.isfile():checks if a given path is a file.
- os.path.isdir(): checks if a given path is a directory.
- os.path.getsize(path): returns the size of a file in bytes.
- CSV: most common format for spreads, excel sheets, comma sperated data.
- CSV module implements classes to read and write tabular data in CSV format
- To import: import csv
- pip install: already included in Python
- CSV Module
- 🔻csv functions that i've used:
- csv.reader(): is used to read from a CSV file row by row.
- csv.writer(): is used to write to a CSV file row by row.
- csv.DictReader() and csv.DictWriter(): are used when the CSV file has a header, allowing you to access data by column names.
- writerow() and writerows(): are used to write rows to a CSV file.
- writeheader(): is used to write the header row to a CSV file when using DictWriter.
- Datetime module supplies classes to work with dates, time anda datetime.
- To import: "import datetime"
- pip install: already included in Python
- Datetime Module
- 🔻Datetime functions that i've used:
- datetime():creates datetime objects
- datetime.now(): Returns the current local date and time.
- strftime():Returns a string representing the date and time, formatted according to the specified format.
- strptime():Parses a string representing a date and time according to a specified format.
- fromisoformat(): Returns a string representing the date and time in ISO
- timedelta(): duration or difference between two dates or times.
- datetime.astimezone(tz=None): Converts the datetime object from one timezone to another.
- datetime.replace(tzinfo=tz): Replaces the timezone information of the datetime object.
- datetime.(): (year, month, day, hour, minute, second): returns the written data.
- Math Module: provides a set of mathematical functions and constants for mathematical operations.
- To import: "import math"
- pip install: pip install math
- Math Module
- 🔻Math functions that i've used:
- math.pow(x, y): Returns x raised to the power y
- math.sqrt(): square root of a number
- math.ceil(): ceils a number
- math.floor(): floors a number
- math.factorial(): factorial of a number
- math.gcd(): greatest common diviser
- Pytz module: creates aware datetime obj with timezone. All Olson timzones supported.
- To import: pip install "import Pytz
- pip install: pip install pytz
- Pytz Module
- 🔻Math functions that i've used:
- pytz.timezone(: gets tz info of an object.)
- Pyshorteners module: URL shortening library. Some API's not working anymore.
- To import: import pyshorteners
- pip install: pip install pyshorteners
- pyshorteners Module
- 🔻Pyshorteners functions that i've used:
- pyshorteners.pyshorteners(): shortens URL
- Requests module: HTTP module.
- to import: import requests
- pip install : pip install requests
- Requests
- 🔻Requests functions that i've used:
- requests.get():
- requests.