# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

import numpy as np

# +
arr = np.arange(1,10)
print(arr)
print(arr+2)
print(arr-2)
print(arr*2)
arr=arr**2

arr
# -

print('First Four : {}'.format(arr[:4]))
print('Last Four : {}'.format(arr[-4:]))
print('Start at 2, exclude last 2 : {}'.format(arr[2:-2]))
print('Start at 0, pick odd indexes : {}'.format(arr[0:arr.size:2]))
print('Sort descending : {}'.format(arr[::-1]))

arr = np.array([
    ['Alice', 'Beth','Cathy', 'Dorothy'],
    ['65', '78', '90','81'],
    ['71', '82', '79', '92']
])
print(arr)

arr[...,-2:]

StarcoderdataJupyterScriptsDedupFiltered