<jupyter_start><jupyter_text>Difference in the indexing and slicing:<jupyter_code>b[:,1]                       #Returns in the vector form -> Indexing
b[:,1:2]                     #Returns in a matrix form   ->Slicing<jupyter_output><empty_output><jupyter_text>Though the answer is the same numerically, the format differs for the indexing and slicing methods  Print the elements row-wise:<jupyter_code>for i in b:
    print(i)<jupyter_output>[1 2 3]
[4 5 6]
[7 8 9]<jupyter_text>Built-in-func:<jupyter_code>dir(b)<jupyter_output><empty_output><jupyter_text>.flat() method:  [prints the elements cell by cell in a flattened format]<jupyter_code>for cell in b.flat:
    print(cell)<jupyter_output>1
2
3
4
5
6
7
8
9<jupyter_text>.reshape(num_rows , num_cols):   [num_rows * num_cols = num_elem_of_original_mat]<jupyter_code>b
d = b.reshape(9,1)
d
l = np.arange(6)
print(l)
e = np.arange(9,15).reshape(3,2)       # (15-1)-9 = 6 = 3*2
e
d = np.arange(6).reshape(3,2)          # (6-1)-0 = 3*2
d
a = np.array([[[1,2,3],[4,5,6],[7,8,9]],[[11,12,13],[14,15,16],[17,18,19]],[[21,22,23],[24,25,26],[27,28,29]]])
b = a.reshape(9,3,1)
b<jupyter_output><empty_output><jupyter_text>Stacking:   [all the input array dimensions except for the concatenation axis must match exactly]<jupyter_code>d
e<jupyter_output><empty_output><jupyter_text>Vertical stacking:<jupyter_code>np.vstack((d,e))<jupyter_output><empty_output><jupyter_text>Horizontal stacking:<jupyter_code>np.hstack((d,e))<jupyter_output><empty_output><jupyter_text>np.hsplit() , np.vsplit()<jupyter_code>f = np.arange(30).reshape(2,15)
print(f)
np.hsplit(f,3)
np.hsplit(f,5)
g = np.hsplit(f,3)
g[2]
np.vsplit(f,2)
h = np.vsplit(f,2)
h[1]
n = 2000
if n%4==0:
    if n%100==0:
        print(0)
    else:
        print("Leap year")
else:
    print("Not a leap year")<jupyter_output>0
{'fraction_non_alphanumeric': 0.16748768472906403, 'fraction_numerical': 0.06349206349206349, 'mean_word_length': 5.217687074829932, 'pattern_counts': {'":': 0, '<': 34, '<?xml version=': 0, '>': 36, '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': '9', 'dir': 'jupyter-structured-clean-dedup', 'id': '583296', 'license': 'MIT', 'n_tokens_mistral': 849, 'n_tokens_neox': 791, 'n_words': 142, 'path': 'Data-Science-HYD-2k19/Topic-Wise/NUMPY/2. BUILT-IN-FUNC.ipynb', 'repo_name': 'Sanjay9921/Python', 'size': '1827'}