Professional Documents
Culture Documents
Practical-Data Science: Delhi Public School Bangalore - East Artificial Intelligence
Practical-Data Science: Delhi Public School Bangalore - East Artificial Intelligence
ARTIFICIAL INTELLIGENCE
#To access first 5 rows of data from the Jaipur csv file
print(df.head())
#To access last 5 rows of data from the Jaipur csv file
df.tail()
# To Drop a column
df = df.drop(["max_dew_pt_2"], axis=1)
# To Sort the values in descending order of date and print the first 5 rows
jaipur_weather = df.sort_values(by='date',ascending = False)
print(jaipur_weather.head())
# To Sort the values in ascending order of mean temperature and print the first 5 rows
jaipur_weather = df.sort_values(by='mean_temperature',ascending = True)
print(jaipur_weather.head())
# Using matplotlib to start plotting some graphs
import matplotlib.pyplot as plt
import numpy as np
# Scatter Plot
x = df.date
y = df.mean_temperature
plt.scatter(x,y)
plt.xticks(np.arange(0, 676, 60))
plt.xticks (rotation=90)
# Add x and y labels and set a font size
plt.xlabel ("Date", fontsize = 14)
plt.ylabel ("Mean Temperature", fontsize = 14)
plt.title('Mean Temperature at Jaipur', fontsize = 20)
plt.show()
# Line Plots
plt.figure(figsize=(20,10))
x = df.date
y_1 = df.max_temperature
y_2 = df.min_temperature
y_3 = df.mean_temperature
z = y_1-y_2
plt.plot(x,y_1, label = "Max temp")
plt.plot(x,y_2, label = "Min temp")
plt.plot(x,y_3, label = "Mean temp")
plt.plot(x,z, label = "range")
plt.xticks(np.arange(0, 676, 60))
plt.xticks (rotation=30)
plt.legend()
plt.show()
**************
Practical- Computer Vision
Type the below codes in Jupyter Notebook and Execute/Run them for the output. Take the printout of
the codes along with their outputs and stick them on plain side(left) of the Journal. Also write the codes
(without the output) on the ruled side.
Make sure Images folder (with images) is in the same folder as the Jupyter Notebook.
# Cropping images
img = cv2.imread('Images/flower.jpg') #Load the image file into memory
plt.imshow(cv2.cvtColor(img, cv2.COLOR_BGR2RGB))
roi = img[2000:3100,1400:2650] #img[range of y, range of x]
plt.imshow(cv2.cvtColor(roi, cv2.COLOR_BGR2RGB))
plt.title('flower')
plt.axis('off')
plt.show()
# Copy 'flower' in multiple places
img = cv2.imread('Images/flower.jpg')
flower = img[2000:3100,1400:2650]
img[0:1100,0:1250]=img[0:1100,2500:3750]=img[4555:5800,0:1250]=img[4555:5800,2500:3750]=flower
plt.imshow(cv2.cvtColor(img, cv2.COLOR_BGR2RGB))
plt.title('more flowers')
plt.axis('on')
plt.show()
# access the RGB pixel located at x=500, y=500
[B,G,R] = img[500, 500] #img[y,x]
print('Red=', R, 'Green=', G, 'Blue=',B)
*************
Activity 1:
Make a Powerpoint presentation on the topic " Communication and the Communication cycle". Points to be
INCLUDED in the Presentation.
a. What is Communication?
b. Its importance in daily life.
c. The Communication cycle.
Paste the pictures of slides on blank side in AI Journal.
Activity 2:
Explain all 17 SDG's along with its pictures.
PROJECT (To be done in the Practical Journal)
The Corpus
Accomplish the following challenges on the basis of the corpus given above.
1. Sentence Segmentation
2. Tokenisation
3. Stopwords removal
4. Lowercase conversion
5. Stemming
6. Lemmatisation
7. Bag of Words: Create a document vector table for all documents.
8. Generate TFIDF values for all the words.
9. Find the words having highest value.
10. Find the words having the least value.
**********