Html Css Basics

Mon 30 June 2025
# Cell 1 - HTML Example
from IPython.display import display, HTML


html_content_1 = """
<!DOCTYPE html>
<html>
<head>
    <title>HTML Cell 1</title>
</head>
<body>
    <h1>HTML Practice Cell 1</h1>
    <p>This is unique content for HTML cell 1.</p>
    <ul>
        <li>Item 1</li>
        <li>Item 2</li>
        <li>Item 3 …

Category: basics

Read More

Ipl 2023 Batting Analysis

Mon 30 June 2025
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
df = pd.read_csv(r'C:\datasets\ipl_2023_batting.csv')
df
Player Runs Matches Balls Strike Rate Average
0 Shubman Gill …

Category: pandas-work

Read More

Iris Knn Classifier

Mon 30 June 2025
from sklearn.datasets import load_iris
from sklearn.neighbors import KNeighborsClassifier
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score
iris = load_iris()
X, y = iris.data, iris.target
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2)
model = KNeighborsClassifier(n_neighbors=3)
model.fit(X_train, y_train)

Category: basics

Read More

Itertools

Mon 30 June 2025
import itertools
list(itertools.count(10, 2))[:11]
list(itertools.cycle('ABCD'))[:12]
list(itertools.repeat('hello', 5))
list(itertools.accumulate([1,2,3,4]))
list(itertools.chain('ABC', 'DEF'))
list(itertools.compress('ABCDEF', [1,0,1,0,1,0]))
list(itertools.dropwhile(lambda x: x<5, [1,4,6 …

Category: basics

Read More

Lambda Map Filter Reduce

Mon 30 June 2025
x = [1, 2, 3]
y = ['a', 'b', 'c']
z = zip(x, y)
print(list(z))
[(1, 'a'), (2, 'b'), (3, 'c')]
x = lambda a, b, c : a + b + c
print(x(1, 2, 3))
6
nums = [1, 2, 3, 4, 5, 6]
result = list(filter(lambda x: x % 2 == 0 …

Category: basics

Read More

List Vs Tuple

Mon 30 June 2025
import time
list1 = [1, 2, 3]
list1[0] = 100
tuple1 = (1, 2, 3)
try:
    tuple1[0] = 100
except TypeError as e:
    print("Tuples are immutable:", e)
Tuples are immutable: 'tuple' object does not support item assignment
def list_test():
    list_x = [x for x in range(1000000)]

def tuple_test():
    tuple_x = tuple(x …

Category: basics

Read More

Loops And Conditions

Mon 30 June 2025
for i in range(1, 6):
    print(f"Square of {i} is {i**2}")
Square of 1 is 1
Square of 2 is 4
Square of 3 is 9
Square of 4 is 16
Square of 5 is 25
n = 5
while n > 0:
    if n % 2 == 0:
        print(n …

Category: basics

Read More

Matplotlib Demo

Mon 30 June 2025
import matplotlib.pyplot as plt
x = [1, 2, 3, 4, 5]
y = [5, 7, 4, 6, 8]
plt.plot(x, y, marker='o')
plt.title("Line Plot")
plt.xlabel("X")
plt.ylabel("Y")
plt.grid(True)
plt.show()

png

names = ["A", "B", "C"]
scores = [75, 88, 92]
plt.bar(names, scores …

Category: basics

Read More

Matplotlib Visuals

Mon 30 June 2025
import matplotlib.pyplot as plt
plt.plot([1, 2, 3, 4])
plt.show()
import matplotlib.pyplot as plt
plt.plot([1, 2, 3, 4], [1, 4, 9, 16])
plt.title('Plot 2: Line Plot')
plt.show()
import matplotlib.pyplot as plt
plt.bar([1,2,3], [3,7,5])
plt …

Category: pandas-work

Read More

Numpy Basics

Mon 30 June 2025
import numpy as np
a = np.array([1, 2, 3])
b = np.array([[1, 2], [3, 4]])
print("1D array:", a)
print("2D array:\n", b)
1D array: [1 2 3]
2D array:
 [[1 2]
 [3 4]]
print("Sum:", a.sum())
print("Mean:", a.mean())
print("Max:", a …

Category: basics

Read More
Page 3 of 6

« Prev Next »