Python使用表达式查找数据帧值

Python使用表达式查找数据帧值,python,pandas,dictionary,dataframe,Python,Pandas,Dictionary,Dataframe,从中,作者使用了: names = ['Bob','Jessica','Mary','John','Mel'] births = [968, 155, 77, 578, 973] # Name associated with the maximum value MaxName = df['Names'][df['Births'] == df['Births'].max()].values ## what does the == means? 它叫什么?它是否仅适用于pandas?表示条件为真的

从中,作者使用了:

names = ['Bob','Jessica','Mary','John','Mel']
births = [968, 155, 77, 578, 973]
# Name associated with the maximum value
MaxName = df['Names'][df['Births'] == df['Births'].max()].values ## what does the == means?

它叫什么?它是否仅适用于pandas?

表示条件为真的“名称”中的任何元素。它被称为布尔索引,可以在这里找到:

==在整个Python中用于测试两个对象是否相等。如果您还没有遇到它,您可能想看看一般的Python教程,而不是直接跳到假定有一些一般Python知识的pandas教程。