python - Pandas get cell value by row NUMBER (NOT row index) and column NAME
问题描述
data = [['tom', 10], ['nick', 15], ['juli', 14]]
df = pd.DataFrame(data, columns = ['Name', 'Age'], index = [7,3,9])
display(df)
df.iat[0,0]
I'd like to return the Age in first row (basically something like df.iat[0,'Age']. Expected result = 10
Thanks for your help!
解决方案
df['Age'].iloc[0]
works too, similar to what Chris had answered.
推荐阅读
- matlab - 读取大量数据的最佳方式
- c# - 按子字符串将字符串列表排序到Excel工作表中
- c - 如何在 Linux 中定义具有非默认返回类型的系统调用?
- python-3.x - 如何指定 gspread 在运行 import_csv 函数以分隔字段时使用的分隔符?
- select - 如何使用 yq 根据子键值选择所有 YAML 键?
- python - 将什么 python 集合发送到 winrt `Windows.Storage.Streams.DataReader` readbytes() 方法?
- reactjs - Google Analytics/React GA:History 对象随着每次位置变化发送越来越多的点击
- python - 使用计算机视觉进行距离测量
- python - 不确定 CSV 文件是否使用 csv.writer 编码为 utf-8
- javascript - NodeJS 14.x - 原生 AWS Lambda 导入/导出支持