<jupyter_start><jupyter_text>`ndarray[start:end]``ndarray[start:]``ndarray[:end]`<jupyter_code>import numpy as np 

x = np.arange(10)
print(x)

print(x[2:6]) #start from index 2 to index 6 exclusive 
x = np.arange(10).reshape(5,2)
print(x)<jupyter_output>[[0 1]
 [2 3]
 [4 5]
 [6 7]
 [8 9]]<jupyter_text>get access 2nd row<jupyter_code>print(x[2, :])<jupyter_output>[4 5]<jupyter_text>get access all the values of 2nd columns, this way return a **rank 1 ndarray**<jupyter_code>X = np.arange(25).reshape(5,5)
print(X)
print()

# rank 1 ndarray 
r1 = X[:, 1]
print(r1)
print(r1.shape)
print()

# rank 2 ndarray 
r2 = X[:, 1:2] # [all the row : column from 1 to 2 (exclusive) ]
print(r2)
print(r2.shape)
print()

r3 = X[:, 1:3]
print(r3)
print(x[:, 1])<jupyter_output>[1 3 5 7 9]<jupyter_text>To get access a single element use ```ndarrady[row,column]``` formate<jupyter_code>print(x[3,0])
y = np.arange(25, dtype=int).reshape(5,5)
print(y)
print(y.dtype)
# get only the values of 4th columns and mean 
print(y[:, 3])
print(y[:,3].mean())<jupyter_output>[ 3  8 13 18 23]
13.0<jupyter_text>Get the **average** value of each column and row<jupyter_code>print(y.mean(axis=0)) # mean of all the columns
print(y.mean(axis=1)) # mean of all the rows<jupyter_output>[10. 11. 12. 13. 14.]
[ 2.  7. 12. 17. 22.]
{'fraction_non_alphanumeric': 0.18090839107005388, 'fraction_numerical': 0.07159353348729793, 'mean_word_length': 5.435643564356436, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 16, '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': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '630653', 'license': 'MIT', 'n_tokens_mistral': 635, 'n_tokens_neox': 579, 'n_words': 146, 'path': 'Jupyter-Notebook/Numpy/Slicing Numpy array .ipynb', 'repo_name': 'shohan4556/machine-learning-course-notes', 'size': '1299'}