Hslip2
Q1]
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>About My City</title> <style> body { background-color: pink; /* Pink background color */ margin: 0; padding: 0; }#cityName {
font-size: 24pt; /* Large text size */
color: blue; /* Blue text color */
text-align: center;
margin-top: 20px;
}
.landmark {
margin: 10px 0;
}
#landmark1 {
color: green; /* Different color */
font-style: italic; /* Different style */
font-family: 'Arial', sans-serif; /* Different font */
}
#landmark2 {
color: purple; /* Different color */
font-weight: bold; /* Different style */
font-family: 'Verdana', sans-serif; /* Different font */
}
#landmark3 {
color: orange; /* Different color */
text-decoration: underline; /* Different style */
font-family: 'Georgia', serif; /* Different font */
}
#image {
display: block;
margin: 20px auto;
}
</style>
</head>
<body>
<h1 id="cityName">My City</h1>
<div class="landmark" id="landmark1">Landmark 1</div>
<div class="landmark" id="landmark2">Landmark 2</div>
<div class="landmark" id="landmark3">Landmark 3</div>
<img src="your_image_url.jpg" alt="City Image" id="image" style="width: 80%;">
</body>
</html>
Q2]
a]
import pandas as pd
Load data from Data.csv
data = pd.read_csv('Data.csv')
Replace missing values with mean
data['salary'].fillna(data['salary'].mean(), inplace=True)
data['age'].fillna(data['age'].mean(), inplace=True)
Save the modified data to a new CSV file if needed
data.to_csv('Data_filled.csv', index=False)
B]
import pandas as pd
import matplotlib.pyplot as plt
Assuming 'Data.csv' has a 'name' and 'salary' column
data = pd.read_csv('Data.csv')
Generate a line plot
plt.plot(data['name'], data['salary'])
plt.xlabel('Name')
plt.ylabel('Salary')
plt.title('Name vs Salary')
plt.xticks(rotation=90) # Rotate x-axis labels for better visibility
plt.show()
c]
import pandas as pd
Assuming the dataset is named 'heights_weights.csv'
data = pd.read_csv('heights_weights.csv')
Display the first 10 rows
print("First 10 rows:")
print(data.head(10))
Display the last 10 rows
print("\nLast 10 rows:")
print(data.tail(10))
Display random 20 rows
print("\nRandom 20 rows:")
print(data.sample(20))
Display the shape of the dataset
print("\nShape of the dataset:")
print(data.shape)