🐍 Pythons learning
PYTHON • DATA SCIENCE • AI

Master Python, Data Science & Machine Learning

#Python #Pandas #NumPy #MachineLearning #Projects

Monday, November 23, 2026

JSON Module in Python: Parsing and Writing JSON Data

The json module in Python allows you to encode and decode JSON (JavaScript Object Notation) data. It provides built-in methods for converting Python data structures to JSON strings and vice versa, essential for working with web APIs and configuration files.


Installation:

Built-in module (No installation required)


Key Features:

- Convert Python dictionaries/lists to JSON strings (json.dumps)

- Parse JSON strings into Python data structures (json.loads)

- Read and write JSON directly to/from files (json.dump, json.load)

- Customizable serialization and formatting with indentations


Code Example:

import json


# Python dictionary to JSON string

data = {"name": "Alice", "role": "Developer", "skills": ["Python", "JSON"]}

json_str = json.dumps(data, indent=4)

print("JSON String:\n", json_str)


# Parse JSON string back to dictionary

parsed = json.loads(json_str)

print("Parsed Name:", parsed["name"])

Datetime Module in Python: Handling Dates and Times

The datetime module supplies classes for manipulating dates and times in Python. It supports date and time arithmetic, formatting, parsing, and time zone management.


Installation:

Built-in module (No installation required)


Key Features:

- Work with dates (date), times (time), and combined date-time (datetime)

- Measure time spans and intervals using timedelta

- Format dates to strings (strftime) and parse strings to dates (strptime)

- Time zone aware calculations with timezone


Code Example:

from datetime import datetime, timedelta


# Get current date and time

now = datetime.now()

print("Current DateTime:", now.strftime("%Y-%m-%d %H:%M:%S"))


# Add 7 days to current date

future_date = now + timedelta(days=7)

print("Date in 7 days:", future_date.strftime("%Y-%m-%d"))

Math Module in Python: Essential Mathematical Functions

The math module in Python provides access to mathematical functions defined by the C standard. It includes functions for trigonometry, logarithms, power functions, rounding, and common mathematical constants like pi and e.


Installation:

Built-in module (No installation required)


Key Features:

- Trigonometric and hyperbolic functions (sin, cos, tan, asin, acos)

- Logarithmic and exponential functions (log, log10, exp, pow)

- Rounding and remainder functions (ceil, floor, trunc, fmod)

- Mathematical constants (math.pi, math.e, math.tau, math.inf)


Code Example:

import math


# Calculate square root, factorial, and trigonometric values

print("Square Root of 16:", math.sqrt(16))

print("Factorial of 5:", math.factorial(5))

print("Value of Pi:", math.pi)

print("Sine of 90 degrees:", math.sin(math.radians(90)))

OS Module in Python: Working with Files and Directories

The os module in Python provides a portable way of using operating system dependent functionality. It allows you to interact with the file system, manage files and directories, execute system commands, and retrieve environment variables.


Installation:

Built-in module (No installation required)


Key Features:

- Directory management (create, delete, list contents, change working directory)

- File path manipulation (os.path.join, os.path.exists, os.path.abspath)

- Environment variable access (os.environ, os.getenv)

- Process management and file permission settings


Code Example:

import os


# Get current working directory

cwd = os.getcwd()

print("Current Directory:", cwd)


# List files in current directory

files = os.listdir('.')

print("Files count:", len(files))


# Check if path exists

print("Is 'test' directory present?:", os.path.exists('test'))

Scikit-learn Library in Python: Getting Started with Machine Learning

Scikit-learn is the premier machine learning library in Python. Built on top of NumPy, SciPy, and Matplotlib, it provides simple and efficient tools for predictive data analysis, classification, regression, clustering, and model selection.


Installation:

pip install scikit-learn


Key Features:

- Comprehensive algorithms for Classification, Regression, and Clustering

- Data preprocessing, scaling, and feature extraction tools

- Model evaluation tools like cross-validation and hyperparameter tuning

- Consistent and user-friendly API (`fit`, `predict`, `transform`)


Code Example:

from sklearn.linear_model import LinearRegression

import numpy as np


# Sample training data

X = np.array([[1], [2], [3], [4], [5]])

y = np.array([2, 4, 6, 8, 10])


model = LinearRegression()

model.fit(X, y)

print("Prediction for 6:", model.predict([[6]])[0])

BeautifulSoup (bs4) Library in Python: Web Scraping Guide

BeautifulSoup (bs4) is a Python library for pulling data out of HTML and XML files. It works with your favorite parser to provide idiomatic ways of navigating, searching, and modifying the parse tree, making web scraping simple and fast.


Installation:

pip install beautifulsoup4


Key Features:

- Parse HTML and XML documents effortlessly

- Navigate parse trees using tag names, attributes, and CSS selectors

- Handles poorly formatted HTML (malformed markup) automatically

- Convert incoming documents to Unicode and outgoing documents to UTF-8


Code Example:

from bs4 import BeautifulSoup


html_doc = "<html><head><title>Python Scraping</title></head><body><p class='content'>Hello World</p></body></html>"

soup = BeautifulSoup(html_doc, 'html.parser')


print("Title:", soup.title.string)

print("Paragraph:", soup.find('p', class_='content').text)

Requests Library in Python: Working with APIs and HTTP

Requests is an elegant and simple HTTP library for Python, built for human beings. It allows you to send HTTP/1.1 requests easily, with features like automatic content decoding, session management, and JSON support.


Installation:

pip install requests


Key Features:

- Simple and intuitive API for GET, POST, PUT, DELETE requests

- Automatic JSON parsing and encoding

- Custom headers, query parameters, and form data support

- Connection pooling, SSL verification, and timeout settings


Code Example:

import requests


# Send GET request to a public API

response = requests.get('https://api.github.com')

print("Status Code:", response.status_code)

print("Content-Type:", response.headers['content-type'])

data = response.json()

print("Keys in response:", list(data.keys())[:5])

Matplotlib Library in Python: Data Visualization Basics

Matplotlib is a comprehensive library for creating static, animated, and interactive visualizations in Python. It provides a MATLAB-like interface for simple plotting and customization of charts, graphs, and figures.


Installation:

pip install matplotlib


Key Features:

- Create publication-quality plots with customizable axes, labels, and legends

- Supports various chart types: line plots, scatter plots, bar charts, histograms, pie charts, and 3D plots

- Integrates seamlessly with NumPy and Pandas DataFrames

- Export figures in high-resolution formats like PNG, PDF, and SVG


Code Example:

import matplotlib.pyplot as plt


# Plot simple line graph

x = [1, 2, 3, 4, 5]

y = [2, 4, 6, 8, 10]

plt.plot(x, y, label='Linear Growth')

plt.xlabel('X Axis')

plt.ylabel('Y Axis')

plt.title('Sample Plot')

plt.legend()

plt.show()

Pandas Library in Python: Data Analysis Made Easy

Pandas is a powerful open-source data manipulation and analysis library for Python. It provides data structures like DataFrames and Series, making data cleaning, transformation, and analysis seamless and efficient.


Installation:

pip install pandas


Key Features:

- DataFrame object for data manipulation with integrated indexing

- Tools for reading and writing data between in-memory data structures and different formats (CSV, Excel, SQL, JSON)

- Data alignment and integrated handling of missing data

- Reshaping and pivoting of data sets, label-based slicing, indexing, and subsetting


Code Example:

import pandas as pd


# Create DataFrame

data = {'Name': ['Alice', 'Bob', 'Charlie'], 'Age': [25, 30, 35]}

df = pd.DataFrame(data)

print("DataFrame:")

print(df)

print("Mean Age:", df['Age'].mean())

NumPy Library in Python: Complete Beginner's Guide

NumPy (Numerical Python) is a fundamental library for scientific computing in Python. It provides support for large, multi-dimensional arrays and matrices, along with a collection of mathematical functions to operate on these arrays efficiently.


Installation:

pip install numpy


Key Features:

- Fast and efficient N-dimensional array object (ndarray)

- Mathematical and logical operations on arrays

- Built-in linear algebra, Fourier transform, and random number generation

- Seamless integration with C/C++ and Fortran code


Code Example:

import numpy as np


# Create array

arr = np.array([1, 2, 3, 4, 5])

print("Array:", arr)

print("Mean:", np.mean(arr))

print("Sum:", np.sum(arr))

Sunday, December 13, 2020

 Graduate and under-graduate Rotational Internship Program

But Why ??

  • LinkedIn profile building
  • interviews skills
  • Workshops/guidance for personality insights
  • further education, etc. 
  • Paid Job Offer after 12 months.

A unique global, multicultural & rare diverse working environment available for interns. We are located across the world and ensure successful projects.

How

An intern will start with a function he/she is most comfortable with. The function will remain unchanged for at least 2 years.

At the end of three months, the intern can choose to move to any other function of his/her interest.

OUR PARTERN

Jooble 

Founded: 27 March 2006

Area served: Country USA

Headquarters: Kyiv, Ukraine

Number of employees: 400

Founders: Yevgeniy Sobakarev, Roman Prokofiev

Subsidiary: Hotwork

homejobslover https://angel.co/company/sach-educational-support-1/jobs



Founded : 2018

Area served: Country United Arab Emirates DUBAI

Jooble is a job search engine in USA to created for a single purpose : To help you find the job of your dreams!



Sunday, December 6, 2020

 https://raw.githubusercontent.com/AdiPersonalWorks/Random/master/student_scores%20-%20student_scores.csv

Wednesday, September 30, 2020

security updates about Python 3.7.9 and 3.6.12

Security updates about Python 3.7.9 and 3.6.12 

python 3.7.9 and 3.6.12 the updated security fix rollup for Python 3.7 and Python 3.6, are finally now available. 

You can find here the release files folder that includes update related binary installer for 3.7.9.

security updates about Python 3.7.9 and 3.6.12
security updates about Python 3.7.9 and 3.6.12 


A separated link is available below :

Tuesday, September 29, 2020

python trending terminology course ebook

python trending terminology course ebook

Hello everyone, congrats!! python tutorials point publish python trending course written by Mr. Pagar Sachin so Let's start to see It's the specification:

Become a Python Programming Expert With Ease!

python trending terminology course ebook
python trending terminology course ebook

Click on BUY THIS EBOOK

Finally what you will learn after Buy this E-book (python tutorials point):

 

Monday, September 28, 2020

Which is Major new features of the 3.9 series as compared to 3.8

Finally, Python 3.9.0rc2 is now available for testing

Welcome to our blog for the latest news on python programming. so finally python developer announced that 3.9.0rc2 is now available for testing.

 Python 3.9.0rc2 is almost ready to do. This release, 3.9.0rc2, is the final planned preview before the last release of Python 3.9 on 2020-10-04. 

new features of the 3.9 series as compared to 3.8
 new features of the 3.9 series as compared to 3.8

Wednesday, September 2, 2020

10 ways to iterate through a list in python

10 ways to iterate through a list in python

The list is similar to array in other languages except for python, which provides the extra benefit of being dynamic in size nature. In Python, the list is a type of  Data Structures, which is used to store different and multiple kinds of data at the same time.
10 ways to iterate through a list in python
10 ways to iterate through a list in python

There are many ways to iterate over a list in Python language. Let’s see all different ways in python:

  1.  Using For loop in python
  2.  For loop and range() in python
  3.  Using while loop in python
  4.  Using list comprehension  ways in python
  5.  Using enumerate() in python
  6.  Using Numpy in python
  7. Using iterable without index in python
  8. Using general way via index
  9. Using the enumerate type function
  10. Using negative indexes in python

Sunday, August 30, 2020

how to create two dimensional array in python language

How to create a two-dimensional array in python language:

Welcome everyone, Today we will learn how to create a two-dimensional array in python so let's start:
How do you create a two-dimensional array in Python language?
how to create two dimensional array in python
how to create a two-dimensional array in python


There are different ways to create Numpy arrays in python:

  • Using special library functions
  • Using Numpy functions
  • Conversion from other Python structures like lists
we know that Python provides many ways to create 1-dimensional,2-dimensional lists/arrays.  so let's start to create a 1D array of size N initialized with 1s.
learn Matplotlib for Data Visualization 

Thursday, August 27, 2020

k means clustering algorithm python example

k means clustering algorithm python example

K Means Clustering is unsupervised learning algorithm in python (i.e.it's tries to cluster the different data based on their similarity) and another meaning is that there is no outcome to be predicted data. K Means Clustering algorithm just tries to find patterns in the data.
There are 3 steps for K Means Clustering with Python:
  • # step1: Initialisation – K initial means centroid in python are generated at random
  • # step2: Assignment – K clusters are created by observation with the nearest centroids data
  • # step3: Update – It's becomes the new mean
wan to learn learn Logistic regression then click on it.

 Initialisation – K initial means centroide in python are generated at random

Import Libraries
import seaborn as ns
import matplotlib.pyplot as plt
%matplotlib inline
Create some Data

from sklearn.datasets import make_blobs

Assignment – K clusters are created by observation with the nearest centroides data


data = make_blobs(n_samples=190, n_features=2, 
                           centers=4, cluster_std=1.7,random_state=100)
Visualize Data
plt.scatter(data[0][:,0],data[0][:,1],c=data[1],cmap='rainbow')
<matplotlib.collections.PathCollection at 0x11ab34d30>
k means clustering algorithm python example
k means clustering algorithm python example


from sklearn.cluster import KMeans
kmeans = KMeans(n_clusters=4)
kmeans.fit(data[0])
KMeans(copy_x=True, init='k-means++', max_iter=200, n_clusters=4, n_init=9,
    n_jobs=1, precompute_distances='auto', random_state=None, tol=0.001,
    verbose=0)

Update – It's becomes the new mean


kmeans.cluster_centers_
array([[-3.13591321,  6.95389851],
       [-7.46941837, -5.56081545],
       [-1.0123077 ,  3.13407664],
       [ 2.71749226,  6.01388735]])
kmeans.labels_
array([1, 3, 1, 3, 3, 0, 2, 1, 3, 1, 2, 1, 3, 3, 2, 1, 3, 1, 0, 2, 2, 1, 1,
       1, 1, 0, 0, 1, 3, 3, 2, 0, 3, 1, 1, 2, 0, 1, 0, 1, 0, 2, 2, 1, 1, 1,
       1, 1, 0, 1, 1, 2, 3, 1, 0, 2, 1, 1, 2, 3, 0, 3, 0, 2, 3, 1, 0, 3, 1,
       3, 3, 1, 0, 1, 0, 3, 3, 1, 2, 1, 1, 0, 3, 0, 1, 1, 1, 2, 1, 0, 0, 1,
       3, 1, 1, 0, 3, 2, 0, 3, 1, 0, 1, 1, 3, 1, 0, 3, 0, 0, 3, 2, 2, 3, 2,
       2, 2, 2, 3, 2, 1, 2, 1, 2, 1, 3, 2, 1, 0, 2, 2, 2, 1, 0, 0, 2, 3, 2,
       2, 1, 0, 3, 0, 2, 2, 3, 1, 0, 2, 2, 2, 2, 1, 3, 1, 2, 3, 3, 3, 1, 1,
       2, 1, 2, 0, 2, 1, 3, 2, 1, 3, 1, 2, 3, 1, 2, 3, 3, 0, 3, 2, 0, 0, 1,
       1, 0, 3, 0, 0, 1, 3, 3, 3, 2, 0, 1, 3, 3, 0, 3], dtype=int32)

f, (ax1, ax2) = plt.subplots(1, 2, sharey=True,figsize=(11,7))
ax1.set_title('K Means cluster')
ax1.scatter(data[0][:,0],data[0][:,1],c=kmeans.labels_,cmap='rainbow')
ax2.set_title("Original/main")
ax2.scatter(data[0][:,0],data[0][:,1],c=data[1],cmap='rainbow')


<matplotlib.collections.PathCollection at 0x11da01be0>
k means clustering  examples
k means clustering examples
Summary:
In this section we learn the k means clustering algorithm python example in detailed, about this section if you have any problem then please comment me.
Tags:
k means clustering algorithm python example, python, machine learning
If you want to learn sector support machine algorithms then click on it.
BEST OF LUCK!!!

Decision Trees and Random Forests classifier-Types in Python

Decision Trees and Random Forests classifier in Python

Welcome everyone, Today we will see Decision Trees and Random Forests classifier-and Types in Python so let's start:
In this project following steps are used to performed operation:
  • Import algorithm Decision Trees and Random Forests classifier package.
  • Get the data
  • Split data into x/y_training and x/y_test data.
  • Train or fit the data into the different model methods.
  • Prediction and Evaluation the data
  • Decision Trees visualization
  • Random Forests
  • finally generate the Tree (learn different python terminologies)

Import algorithm Decision Trees and Random Forests classifier package

Import Libraries
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
%matplotlib inline

Get the Data
df = pd.read_csv('Decision Trees.csv')

df.head()
Decision Age Number Start
0 present 34 3 9
1 absent 58 4 15
2 absent 28 5 8
3 present 72 3 4
4 absent 81 4 15

Split data into x/y_training and x/y_test data.

Let's start to split up the data into a training and test set.
from sklearn.model_selection import train_test_split
x = df.drop('Decision Trees',axis=1)
y = df['Decision Trees']
x_train, x_test, y_train, y_test = train_test_split(x, y, test_size=0.20)

Wednesday, August 26, 2020

k nearest neighbor python numpy language

k nearest neighbor python numpy language:

Welcome everyone in python crash course (Machine learning). This is first part of this section,if you want to learn SVM in python then click on it.
 K Nearest Neighbors method also used for data prediction purpose, so in his section we will learn  K Nearest Neighbors predict method.
k nearest neighbor python numpy language
k nearest neighbor python numpy language

How do you use K nearest neighbor in Python language in smart way?

In this project following steps are used to performed operation:
  • Import k-nearest neighbor algorithm package.
  • Then Create feature and target variables using function.
  • Split data into x/y_training and x/y_test data.
  • Generate a k-NN value model using neighbor method.
  • Train or fit the data into the different model methods.
  • finally Predict the future data

What is K nearest neighbor used for?

suppose you have been given a classified data set from a any popular company,they give you the data and the target classes and say predicts a class for a new data point based off of the features.
Let's do it!

JSON Module in Python: Parsing and Writing JSON Data

The json module in Python allows you to encode and decode JSON (JavaScript Object Notation) data. It provides built-in methods for convertin...