import numpy as np

lista = [i for i in range(1, 13)]

arr = np.array(lista)

arr2x6 = arr.reshape(2, 6)

# print(arr2x6)

# sort_by_row = np.sort(arr2x6, axis=0)

# print(sort_by_row)

import time

arr3x5 = np.array([
    [3, 1, 7, 3, 7],
    [2, 5, 7, 3, 2],
    [1, 3, 4, 6, 8]
])

print('Tablica 3x5 przed sortowaniem')
print(arr3x5)

start_sort = time.time()

sort_by_row = np.sort(arr3x5, axis=1, kind='stable')

end_sort = time.time()
print('Tablica 3x5 po sortowaniu')

result = end_sort - start_sort

print(sort_by_row)
print(f'{result:.4f}')

print('*' * 50)

players_data = np.array([
    ("Faker", "T1", 5), 
    ("TheShy", "Weibo Gaming", 1), 
    ("Uzi", "Emerytowany", 0), 
    ("Ruler", "JD Gaming", 1), 
    ("Doinb", "Emerytowany", 1), 
    ("Rekkles", "Los Ratones", 1), 
    ("Caps", "G2 Esports", 0) 
    ], dtype=[('Name', 'U30'), ('Team', 'U30'), ('World Title Count', 'i4')]
)

print('Przed sortowaniem')
print(players_data)
print('Sortowanie po nazwie')

sorted_by_name = np.sort(players_data, order='Name')
print(sorted_by_name)

print([ i[0] for i in sorted_by_name])

sorted_by_team = np.sort(players_data, order='Team')
print(sorted_by_team)

print([i['Team'] for i in sorted_by_team])