Hslip6
Q1]
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"> <style> body { background-color: yellow; } #header { background-color: blue; color: white; padding: 10px; } #menu { background-color: green; padding: 10px; } #content { padding: 20px; } #footer { background-color: red; color: white; padding: 10px; } </style> <title>Your College - About Us</title> </head> <body> <!-- Header Section --> <div id="header"> <h1>Your College</h1> </div> <!-- Menu Section --> <div id="menu"> <nav class="navbar navbar-expand-lg navbar-light"> <a class="navbar-brand" href="#">Your College</a> <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation"> <span class="navbar-toggler-icon"></span> </button> <div class="collapse navbar-collapse" id="navbarNav"> <ul class="navbar-nav ml-auto"> <li class="nav-item active"> <a class="nav-link" href="#content">About Us</a> </li> </ul> </div> </nav> </div> <!-- Content Section --> <div id="content"> <h2>About Your College</h2> <p>Add college information here.</p> </div> <!-- Footer Section --> <div id="footer"> <p>Address: Your College, Street, City, Country</p> </div> <!-- Bootstrap JS and Popper.js --> <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script> </body> </html> Q2] a] import pandas as pdLoad data from Data.csv
data = pd.read_csv('Data.csv')
Replace missing values with the mean of the respective columns
data['salary'].fillna(data['salary'].mean(), inplace=True)
data['age'].fillna(data['age'].mean(), inplace=True)
Save the updated data
data.to_csv('Data_filled.csv', index=False)
b]
import pandas as pd
import matplotlib.pyplot as plt
Load data from Data.csv
data = pd.read_csv('Data.csv')
Generate a line plot of name Vs salary
plt.plot(data['name'], data['salary'], marker='o')
plt.xlabel('Name')
plt.ylabel('Salary')
plt.title('Name Vs Salary')
plt.xticks(rotation=45, ha='right') # Rotate x-axis labels for better visibility
plt.tight_layout()
plt.show()
c]
import pandas as pd
Download the heights and weights dataset from a given CSV file
url = "https://example.com/your_dataset.csv" # Replace with the actual URL
data = pd.read_csv(url)
Print the first, last 10 rows, and random 20 rows
print("First 10 rows:")
print(data.head(10))
print("\nLast 10 rows:")
print(data.tail(10))
print("\nRandom 20 rows:")
print(data.sample(20))
Display the shape of the dataset
print("\nShape of the dataset:", data.shape)