Ml1.ipynb - Colaboratory
Ml1.ipynb - Colaboratory
a= np.array([(1,2,3),(6,7,8),(4,8,6)])
a
array([[1, 2, 3],
[6, 7, 8],
[4, 8, 6]])
a.shape
(3, 3)
a.ndim
a.dtype
output dtype('int64')
b= np.array([(1,2,3),(6,7,8),(3,5,5)])
b
array([[1, 2, 3],
[6, 7, 8],
[3, 5, 5]])
a*b
array([[ 1, 4, 9],
[36, 49, 64],
[12, 40, 30]])
np.matmul(a,b)
a.sum()
45
a.sum(axis=0)
a.sum(axis=1)
a.min()
a.max(axis=0)
array([6, 8, 8])
a.max(axis=1)
array([3, 8, 8])
z = np.ones([2,2])
z
array([[1., 1.],
[1., 1.]])
y[0,1]
import matplotlib
import matplotlib.pyplot as plt
x = [2,4,6]
y = [9,2,1]
plt.plot(x,y)
plt.show()
x1=[1,2,3,4]
y1=[10,20,40,60]
plt.plot(x1,y1,label='First Line')
x2=[4,6,7,9]
y2=[20,30,50,80]
plt.plot(x2,y2,label='Second Line')
plt.xlabel('x-axis')
plt.ylabel('y-axis')
plt.title('plot the Graph')
plt.legend()
plt.show()
x1=[1,2,3,4]
y1=[5,2,4,6]
x2=[1,3,4,6]
y2=[2,7,5,8]
plt.plot(x1,y1, label = 'First line')
plt.plot(x2,y2, label = 'Second line')
plt.xlabel
import pandas as pd
a =[1,2,3,'machine']
serial = pd.Series(a)
print(serial)
0 1
1 2
2 3
3 machine
dtype: object
cal time
0 100 20
1 50 15
2 120 35
df = pd.read_csv('data.csv')
print(df.to_string())
pd.options.display.max_rows
60
df.shape
(41715, 10)
df.head()
Year Industry_aggregation_NZSIOC Industry_code_NZSIOC Industry_name_NZSIOC Unit
Dolla
0 2021 Level 1 99999 All industries
(million
Dolla
1 2021 Level 1 99999 All industries
(million
Dolla
2 2021 Level 1 99999 All industries
(million
Dolla
3 2021 Level 1 99999 All industries
(million
Dolla
4 2021 Level 1 99999 All industries
(million
df.tail()
Food product
41710 2013 Level 3 ZZ11 Pe
manufacturing
Food product
41711 2013 Level 3 ZZ11 Pe
manufacturing
Food product
41712 2013 Level 3 ZZ11 Pe
manufacturing
Food product
41713 2013 Level 3 ZZ11 Pe
manufacturing
Food product
41714 2013 Level 3 ZZ11 Pe
manufacturing
df.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 41715 entries, 0 to 41714
Data columns (total 10 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 Year 41715 non-null int64
1 Industry_aggregation_NZSIOC 41715 non-null object
2 Industry_code_NZSIOC 41715 non-null object
3 Industry_name_NZSIOC 41715 non-null object
4 Units 41715 non-null object
5 Variable_code 41715 non-null object
6 Variable_name 41715 non-null object
7 Variable_category 41715 non-null object
8 Value 41715 non-null object
9 Industry_code_ANZSIC06 41715 non-null object
dtypes: int64(1), object(9)
memory usage: 3.2+ MB