DEV Community

Guru prasanna
Guru prasanna

Posted on

Task-Python Packages

Few Python Packages

Progress Bar and TQDM:
To implement progress bars for tasks such as loops, file processing, or downloads.

from progress.bar import ChargingBar
bar = ChargingBar('Processing', max=20)
for i in range(20):
    # Do some work
    bar.next()
bar.finish()
Enter fullscreen mode Exit fullscreen mode

Output:

Processing ████████████████████████████████ 100%
Enter fullscreen mode Exit fullscreen mode

TQDM: Similar to progress bar but its more simple to setup than progress bar.

from tqdm import tqdm
import time

for i in tqdm(range(100)):
    time.sleep(0.1)
Enter fullscreen mode Exit fullscreen mode

Output:

100%|██████████████████████████████████████| 100/100 [00:00<00:00, 18784.11it/s]
Enter fullscreen mode Exit fullscreen mode

Matplotlib:

Matplotlib is used for creating static, animated, and interactive visualizations.

import matplotlib.pyplot as plt

x = [1, 2, 3, 4, 5]
y = [2, 4, 6, 8, 10]

plt.plot(x, y, label='Linear Growth', color='blue', linestyle='--', marker='o')
plt.title("Line Plot Example")
plt.xlabel("X-axis")
plt.ylabel("Y-axis")
plt.legend()
plt.show()
Enter fullscreen mode Exit fullscreen mode

Output:

Image description

Numpy:
NumPy (Numerical Python) is a fundamental Python library for numerical computing. It provides support for working with large, multi-dimensional arrays (like 1-D,2-D,3-D) and matrices, along with a collection of mathematical functions to operate on these arrays efficiently.

Example:

import numpy as np

# 1D array
arr1 = np.array([1, 2, 3, 4])

# 2D array
arr2 = np.array([[1, 2], [3, 4]])

print(arr1, arr2)
Enter fullscreen mode Exit fullscreen mode

Output:

[1 2 3 4] [[1 2]
 [3 4]]

Enter fullscreen mode Exit fullscreen mode

Pandas:
It is used for data manipulation and analysis with Series(lists) and DataFrame(table or spreadsheet).

Example:

import pandas
x=[1,2,3]
y=pandas.Series(x,index=["no1","no2","no3"])
print(y)
Enter fullscreen mode Exit fullscreen mode

Output:

no1    1
no2    2
no3    3
dtype: int64
Enter fullscreen mode Exit fullscreen mode

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more

Top comments (0)

AWS Security LIVE!

Tune in for AWS Security LIVE!

Join AWS Security LIVE! for expert insights and actionable tips to protect your organization and keep security teams prepared.

Learn More

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay