NumPy Lexsort() - Indirect Sort
Автор: Cloud Data Science
Загружено: 2023-06-22
Просмотров: 696
Описание:
In this video, I delve into the powerful NumPy function (np.lexsort()) called lexsort (indirect sort) and provide you with the ultimate explanation of how it works. If you've ever wondered how to sort arrays based on multiple keys or criteria, lexsort is the solution you've been looking for.
In the world of data analysis and manipulation, sorting arrays is a common task. However, things get trickier when the order of elements depends on different factors or tie-breaking conditions. That's where lexsort comes to the rescue. I break down the concept of indirect sort and explore how lexsort enables us to sort arrays based on multiple keys. I explain the syntax of lexsort, including the order of keys and the primary sorting criterion. By understanding this syntax, you'll have the power to handle complex sorting scenarios with ease. NumPy Lexsort - The Ultimate Introduction
Code used in video:
import numpy as np
a = np.array(["Alice", "Charlie", "Bob", "Alice", "Bob", "Grace", "Charlie"])
b = np.array([1, 4, 2, 3, 5, 7, 6])
sorted_list = np.lexsort((b, a))
print(sorted_list)
Timestamps:
0:00 - Lextsort Intro
3:00 - Example 1
4:20 - Real-World Example
Music from #Uppbeat:
https://uppbeat.io/t/ilya-kuznetsov/f...
License code: IEOU8RC0AY3VXXH6
Please SUBSCRIBE, LIKE, & SHARE for more videos and to stay updated with the latest important videos: https://www.youtube.com/c/CloudDataSc...
Повторяем попытку...
Доступные форматы для скачивания:
Скачать видео
-
Информация по загрузке: