You are on page 1of 4

1/9/24, 5:23 PM 1 - Jupyter Notebook

In [6]: print("welcome")

welcome

In [8]: distance =[10,15,17,26]


time =[.30,.40,.55,1.20]
print(distance)
print(time)

[10, 15, 17, 26]


[0.3, 0.4, 0.55, 1.2]

In [9]: speed = distance[0]/time[0]


print (speed)

33.333333333333336

In [11]: for i in range(4):


speed = distance[i]/time[i]
print(speed)

33.333333333333336
37.5
30.909090909090907
21.666666666666668

In [14]: import numpy as np


np_distance=np.array(distance)
np_time=np.array(time)
speed=np_distance/np_time
print(speed)

[33.33333333 37.5 30.90909091 21.66666667]

In [17]: arr=np.array([[1,2,3],[4,5,6]])
print(arr)

[[1 2 3]
[4 5 6]]

In [18]: arr=np.array([[1,2,3],[4,5,6]])
print(arr.ndim)

localhost:8888/notebooks/1.ipynb 1/4
1/9/24, 5:23 PM 1 - Jupyter Notebook

In [24]: x=np.array([1,2,3,4,5])
y=np.array([2,4,5,4,5])
import matplotlib.pyplot as plt
plt.plot(x,y)
plt.show()

localhost:8888/notebooks/1.ipynb 2/4
1/9/24, 5:23 PM 1 - Jupyter Notebook

In [25]: plt.scatter(x,y)
plt.show()

In [26]: plt.bar(x,y)
plt.show()

localhost:8888/notebooks/1.ipynb 3/4
1/9/24, 5:23 PM 1 - Jupyter Notebook

In [28]: import pandas as pd


data = {'Name':["Gopinath","Aarthy","Sreevatsa","Akshitha"],'Age':[42,36,10,2]}
data_pd=pd.DataFrame(data)
print(data_pd)

Name Age
0 Gopinath 42
1 Aarthy 36
2 Sreevatsa 10
3 Akshitha 2

In [37]: display(data_pd[data_pd.Age<30])

Name Age

2 Sreevatsa 10

3 Akshitha 2

In [ ]: ​

In [1]: from sklearn.linear_model import LinearRegression

In [ ]: ​

localhost:8888/notebooks/1.ipynb 4/4

You might also like