Units of Computer. Memory Measurement
1 bit = Binary digit
8 bits = 1 Byte
1024 byte = 1 kilo bytes
1024 KB = 1 Mega bytes
1024 MB = 1 Giga bytes
1024 GB = 1 Tera bytes
1024 TB = 1 Peta bytes
1024 PB = 1 Exa bytes
1024 EB = 1 Zetta bytes
1024 ZB = 1 Yotta bytes
1024 YB = 1 Bronto bytes
1024 BB = 1 Geop bytes
1 bit = Binary digit
8 bits = 1 Byte
1024 byte = 1 kilo bytes
1024 KB = 1 Mega bytes
1024 MB = 1 Giga bytes
1024 GB = 1 Tera bytes
1024 TB = 1 Peta bytes
1024 PB = 1 Exa bytes
1024 EB = 1 Zetta bytes
1024 ZB = 1 Yotta bytes
1024 YB = 1 Bronto bytes
1024 BB = 1 Geop bytes
import numpy as np
arr = np.array([1, 2, 3])
print("Array with Rank : \n",arr)
arr = np.array([1, 2, 3])
print("Array with Rank : \n",arr)
import numpy as np
arr = np.array([[1, 2, 3],[4, 5, 6]])
print("Array with Rank : \n", arr)
arr = np.array([[1, 2, 3],[4, 5, 6]])
print("Array with Rank : \n", arr)
Output:
Array with Rank :
[[1 2 3]
[4 5 6]]
[Program finished]
Array with Rank :
[[1 2 3]
[4 5 6]]
[Program finished]
Numpy using arrays and tuple program
# Python program for
# Creation of Arrays
import numpy as np
# Creating a rank 1 Array
arr = np.array([1, 2, 3])
print("Array with Rank 1: \n",arr)
# Creating a rank 2 Array
arr = np.array([[1, 2, 3],
[4, 5, 6]])
print("Array with Rank 2: \n", arr)
# Creating an array from tuple
arr = np.array((1, 3, 2))
print("\nArray created using "
"passed tuple:\n", arr)
# Python program for
# Creation of Arrays
import numpy as np
# Creating a rank 1 Array
arr = np.array([1, 2, 3])
print("Array with Rank 1: \n",arr)
# Creating a rank 2 Array
arr = np.array([[1, 2, 3],
[4, 5, 6]])
print("Array with Rank 2: \n", arr)
# Creating an array from tuple
arr = np.array((1, 3, 2))
print("\nArray created using "
"passed tuple:\n", arr)
ndim using program on numpy
import numpy as np a = np.array([(1,2,3),(4,5,6)]) print(a.ndim)
Output :
2
import numpy as np a = np.array([(1,2,3),(4,5,6)]) print(a.ndim)
Output :
2
Itemsize using program on numpy
import numpy as np a = np.array([(1,2,3)]) print(a.itemsize)
Output :
4
import numpy as np a = np.array([(1,2,3)]) print(a.itemsize)
Output :
4
pandas01.py
253 B
Pandas using in python program
NumPy arrays joining program
import numpy as np
arr1=np.array([1,2,3])
arr2=np.array([4,5,6])
arr3=np.array([7,8,9])
arr=np.concatenate((arr1,arr2,arr3))
print(arr)
import numpy as np
arr1=np.array([1,2,3])
arr2=np.array([4,5,6])
arr3=np.array([7,8,9])
arr=np.concatenate((arr1,arr2,arr3))
print(arr)
Area of triangle program
a = 5
b = 6
c = 7
# Uncomment below to take inputs from the user
# a = float(input('Enter first side: '))
# b = float(input('Enter second side: '))
# c = float(input('Enter third side: '))
# calculate the semi-perimeter
s = (a + b + c) / 2
# calculate the area
area = (s*(s-a)*(s-b)*(s-c)) ** 0.5
print('The area of the triangle is %0.2f' %area)
Output
The area of the triangle is 14.70
[Program finished]
a = 5
b = 6
c = 7
# Uncomment below to take inputs from the user
# a = float(input('Enter first side: '))
# b = float(input('Enter second side: '))
# c = float(input('Enter third side: '))
# calculate the semi-perimeter
s = (a + b + c) / 2
# calculate the area
area = (s*(s-a)*(s-b)*(s-c)) ** 0.5
print('The area of the triangle is %0.2f' %area)
Output
The area of the triangle is 14.70
[Program finished]