Shyam kareliya
21162151006
Practical:1
Aim:Installation Step for Anaconda
1. Installation of Software Anaconda, Understands Jupyter notebook,
Spyder, Google Collab IDEs.
Step:1Head over to anaconda.com and install the latest version of
Anaconda. Make sure to download the “Python 3.7 Version” for the
appropriate architecture.
Step:2 Begin with the installation process:
Getting Started:
Shyam kareliya
21162151006
Getting through the License Agreement:
Select Installation Type: Select Just Me if you want the software to
be used by a single User
Choose Installation Location:
Shyam kareliya
21162151006
Advanced Installation Option:
Getting through the Installation Process:
Recommendation to Install Pycharm:
Shyam kareliya
21162151006
Finishing up the Installation:
2 Basic Understanding of Data Science and frequently useful
libraries.
NumPy:
import numpy as np
my_list = [1,4,5,6]
arr1 = np.array(my_list)
x = type(arr1)
print(x)
print(arr1)
np.arange(0,10,2)
np.zeros(5)
np.zeros((3,5))
Shyam kareliya
21162151006
np.ones(3)
np.ones((3,3))
np.random.randint(0,10)
np.random.seed(101)
arr2 = np.random.randint(0,100,10)
print(arr2)
arr2.max()
arr2.min()
arr2.mean()
arr2.argmax()
arr2.argmin()
arr2.reshape(2,5)
mat = np.arange(0,100).reshape(10,10) mat[2,2]
mat[0,:]
mat[:,0]
mat[0:3,0:3]
Shyam kareliya
21162151006
arr3 = np.array([[1,1,2],[4,5,5],[7,5,6]])
print('printing 2-d array: ')
print(arr3)
arr4 =
np.array([[[1,2,3],[2,3,4],[4,5,6]],[[6,7,8],[8,9,10],[10,11,12]],[[1
2,13,14],[14,15,16],[16,17,18]]])
print('printing 3-d array:')
print(arr4)
arr4[1,2]
arr4[1,2,1]
arr4[1,:]
Shyam kareliya
21162151006
Pandas:
import pandas as pd
waffle = ['triple_chocolate','belgium_waffle','red_velvet','honey','cookie_cream']
pd.Series(waffle)
sequen = [1,55,48,2,15,13,77]
x = pd.Series(sequen)
reg = [True,False,True,True,False,False,True]
pd.Series(reg)
mobile =
['ram','rom','memory','display','ui'
]mob = pd.Series(mobile)
mob.values
mob.index
Shyam kareliya
21162151006
mob.dtype
x.sum()
x.product()
x.mean()
vegetable =
['ladyfinger','potato','onion','garlic','cabbage','capsicum','broccoli']
days = ['mon','tue','wed','thur','fri','sat','sun']
pd.Series(vegetable,days)
pd.Series(data = vegetable , index=days)
pd.Series(vegetable , index = days)
pokemon = pd.read_csv("pokemon.csv",index_col="Pokemon")
pokemon.shape
pokemon.head()
Shyam kareliya
21162151006
pokemon.head(11)
pokemon.tail()
pokemon.tail(11)
Shyam kareliya
21162151006
pokemon.values
pokemon.index
pokemon.ndim
pokemon.shape
pokemon.size
pokemon.name='pokemon_new'
pokemon.head()
pokemon[50:101]
pokemon[:51]
pokemon[-31:]
pokemon[-30:-10]
Shyam kareliya
21162151006
pokemon = pd.read_csv("pokemon.csv", index_col="Pokemon", squeeze=True)
pokemon.sort_index(inplace=True)
pokemon.head()
pokemon.get("Moltres")
pokemon.get(["Moltres","
Meowth"])
pokemon.get(key=["Moltres","M
Shyam kareliya
21162151006
eowth"])
pokemon.get(key=["Digimon"])
pokemon.get(key=["Digimon"], default="this is not a Pokemon")
pokemon.value_counts()
pokemon.value_counts().sum()
pokemon.count()
pokemon.value_counts(ascending=True)
pd._version
import matplotlib.pyplot as plt
Shyam kareliya
21162151006
x=[1,2,3,4,5,6]
y=[4,8,5,9,7,2]
plt.plot(x,y)
plt.xlabel("x-axis")
plt.ylabel("y-axis")
plt.title('our first plot')
plt.show()
import numpy as np
t = np.arange(0.0,2.0,0.01)
s = 1 + np.cos(2*np.pi*t)
plt.plot(t,s,'--')
plt.grid()
plt.xlabel('Time(t)')
plt.ylabel('Voltage(mV)')
plt.title('Cosine wave plot(cos(x))')
plt.show()
Shyam kareliya
21162151006
x1 = np.linspace(0.0,5.0)
x2 = np.linspace(0.0,2.0)
y1 = np.cos(2*np.pi*x1)*np.exp(-x1)
y2 = np.cos(2*np.pi*x2)
plt.subplot(2,1,1)
plt.plot(x1,y1,'o-')
plt.title('Subplot-1')
plt.xlabel('x1')
plt.ylabel('Amp(y1)')
plt.subplot(2,1,2)
plt.plot(x2,y2,'.-')
plt.title('Subplot-2')
plt.xlabel('x2')
plt.ylabel('Amp(y2)')
plt.show()
x = [1,2,3,4,5]
y = [25,14,31,10,45]
tick_label = ['One','Two','Three','Four','Five']
plt.bar(x,y,tick_label=tick_label,width = 0.7,color=['green','blue'])
plt.xlabel('x-axis')
plt.ylabel('y-axis')
plt.title('Bar Graph')
plt.show()
Shyam kareliya
21162151006
ages = [2,50,70,40,30,45,50,45,43,40,44,60,
7,13,51,18,90,77,32,21,20,40]
range = (0,100)
bins = 10
plt.hist(ages,bins,range,color='green',histtype='bar',rwidth=0.3)
plt.xlabel('Ages')
plt.ylabel('Bins')
plt.title('Histogram Plot')
plt.show()
x = [1,2,3,4,5,6,7,8,9,10]
y = [2,4,5,7,6,8,9,10,12,11]
plt.scatter(x,y,label="Stars",color='green',marker = "*",s=70)
plt.xlabel('x-axis')
plt.ylabel('y-axis')
plt.title('Scatter Plot')
plt.legend()
plt.show()
Shyam kareliya
21162151006
Shyam kareliya
21162151006
activites = ['eat','sleep','work','play'] slices = [3,7,8,6]
colors = ['r','g','m','b']
plt.pie(slices, labels=activites,
colors=colors,startangle=90,shadow=True,
explode=(0.2,0,0,0),autopct='%1.2f%%')
plt.legend()
plt.show()