<jupyter_start><jupyter_text>NUMPY Tutorial- 2020.01.28<jupyter_code># Import Package
import numpy as np
array = np.array([1, 2, 3])
print("Size of array :" , array.size) 
print("Type of array :" , array.dtype) 
print("Second element in array :" , array[1]) 
A = np.arange(5)  # 0 ~ 4
print(A)
B = np.zeros((4,3))  # 4 by 3 zero matrix (numpy array)
print(B)
C = np.random.randint(0, 10, (3, 3))  # Random number
print(C)
array1 = np.array([1, 2, 3, 4])
print(array1.shape)  # 1 rank
array2 = array1.reshape((2, 2))
print(array2.shape)
print(array2)
a = np.array([[1,2],[3,4]])
b = np.array([[10,20],[30,40]])
# Matrix Addition
c = a + b
c
# Matrix Subtraction
d = b - a
d
# Element - wise Multiplication
e = a * b
e
# Matrix Multiplication
f = a @ b
# f = np.dot(a,b)
# f = np.matmul(a,b)
f
s = np.ones((4,3))
s
t = np.full((2,2),10)
t
t = np.full((3,2),10)
s @ t
np.arange(0,10)  # 0 ~ 9
np.arange(0,10,2)
np.arange(0,10).reshape(2,5)
np.arange(0,6).reshape(3,2).sum(axis=0)
np.arange(0,6).reshape(3,2).sum(axis=1)
a
# Indexing
print(a[0,0])
print(a[1,0])<jupyter_output>1
3
{'fraction_non_alphanumeric': 0.2128252788104089, 'fraction_numerical': 0.08271375464684015, 'mean_word_length': 4.358208955223881, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '34869', 'license': 'MIT', 'n_tokens_mistral': 547, 'n_tokens_neox': 515, 'n_words': 117, 'path': '01. Python_Tutorials/Numpy_Tutorial.ipynb', 'repo_name': 'OH-Seoyoung/Data_Analysis_Club', 'size': '1076'}