📌  相关文章
📜  pandas 从列中提取值 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:14.479000             🧑  作者: Mango

代码示例1
# Find all rows where ColumnA is stringA and give me columnC (Returns a list)
df[df['columnA'] == 'stringA']['columnC']

# Same logic but give me the value at columnC (Returns the first value)
df[df['columnA'] == 'stringA']['columnC'].iat[0]

# multiple arguments (parenthesis are required)
df[(df['columnA'] == 'stringA') & (df['columnB'] >= 53)]['columnC'].iat[0]