slip.4
1.
<!DOCTYPE html>
<html>
<head>
<title>Program for Printing Table</title>
<style>
table, td, th {
border: 1px solid black;
border-collapse: collapse;
padding: 18px;
text-align: center;
}
</style>
</head>
<body>
<h1 align="center">List of Books</h1>
<table align="center">
<tr>
<td rowspan="2">Item No</td>
<td rowspan="2">Item Name</td>
<td colspan="2">Price</td>
</tr>
<tr>
<td>Rs.</td>
<td>Paise</td>
</tr>
<tr>
<td>1.</td>
<td>Programming in Python</td>
<td>500</td>
<td>50</td>
</tr>
<tr>
<td>2.</td>
<td>Programming in Java</td>
<td>345</td>
<td>65</td>
</tr>
</table>
</body>
</html>
2
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import numpy as np
import matplotlib.pyplot as plt
rand_arr = np.random.randint(0, 100, 50)
print("\n*** ____Random numbers ____***\n\n", rand_arr)
x = rand_arr
y = x * 0.5
print("\n\nLine Chart….\n\n")
plt.plot(x, '-', color='tomato', linewidth=3)
plt.xlabel("X - Axis")
plt.ylabel("Y - Axis")
plt.title("Line Chart")
plt.minorticks_on()
plt.grid(visible=True, color='silver', which='minor', alpha=0.8, ls='-', lw=1)
plt.show()
print("\n\nScatter Plot….\n\n")
plt.scatter(x, y, marker='d', c='gold', linewidth=2)
plt.xlabel("X - Axis")
plt.ylabel("Y - Axis")
plt.title("Scatter Plot")
plt.grid(visible=True, color='silver', which='major', alpha=0.8, ls='-', lw=1)
plt.show()
print("\n\nHistogram….\n\n")
plt.hist(x, color='teal')
plt.xlabel("X - Axis")
plt.ylabel("Y - Axis")
plt.title("Histogram")
plt.grid(visible=True, color='silver', which='major', alpha=0.8, ls='-', lw=1)
plt.show()
print("\nBoxPlot….\n\n")
plt.boxplot(x)
plt.xlabel("X - Axis")
plt.ylabel("Y - Axis")
plt.title("Box Plot")
plt.minorticks_on()
plt.grid(visible=True, color='silver', which='minor', alpha=0.8, ls='-', lw=1)
plt.show()
df = pd.read_csv('data.csv')
print("Shape of DataFrame is : ", df.shape)
print("\n Number of rows & Columns : ", df.size)
print("\n\n Data types for DataFrame is : \n\n", df.dtypes)
print("\n\n Feature Names in DataFrame : \n\n", df.columns)
print("\n\n Description of a Data : \n\n", df.describe())
df
Comments
Post a Comment