Python | Pandas Index.min ()
Python - отличный язык для анализа данных, в первую очередь из-за фантастической экосистемы пакетов Python, ориентированных на данные. Pandas - один из таких пакетов, который значительно упрощает импорт и анализ данных.
Pandas Index.min() function returns the minimum value of the Index. The function works with both numerical as well as the string type objects. In case of string type object it returns the string which has smallest value in lexicographical order.
Syntax: Index.min()
Parameters : Doesn’t take any parameter.
Returns : scalar: Minimum value.
Example #1: Use Index.min() function to find the minimum element in the given Index.
# importing pandas as pdimport pandas as pd # Creating the Indexidx = pd.Index(["Labrador", "Beagle", "Mastiff", "Lhasa", "Husky", "Beagle"]) # Print the Indexidx |
Выход :
Now we find the min value in the given Index.
# return min value.idx.min() |
Output :
As we can see in the output, the function has returned ‘Beagle’ which has the smallest lexicographical order among the values present in the Index.
Example #2: Use Index.min() function to find the minimum value in the Index.
# importing pandas as pdimport pandas as pd # Creating the Indexidx = pd.Index([17, 69, 33, 5, 0, 74, 0]) # Print the Datetime Indexidx |
Выход :
Now we will find the minimum value among the labels of the Index.
# the function will return the minimum# value present in the Indexidx.min() |
Выход :
Как видно из выходных данных, функция вернула 0, что является наименьшим значением среди меток индекса.
Внимание компьютерщик! Укрепите свои основы с помощью базового курса программирования Python и изучите основы.
Для начала подготовьтесь к собеседованию. Расширьте свои концепции структур данных с помощью курса Python DS. А чтобы начать свое путешествие по машинному обучению, присоединяйтесь к курсу Машинное обучение - базовый уровень.