从 Pandas/Python 中选定的单元格访问索引/行/列

rus*_*ord 2 python excel numpy dataframe pandas

我应该将具有重要功能的 Excel 电子表格转换为 Web 应用程序。我决定与 Pandas 合作,我想知道解决这个问题的最佳方法是什么。

我需要做的一件事是允许人们输入某个数字(我们称之为lot_number)并访问同一行中的其他值。

例如,如果lot_number = 3address_value在不同的列中将是 555 Something Street。所有的lot_numbersaddress_value条目都不同。

我的问题是:如何address_value使用 pandas 进行访问lot_number

Add*_*ers 5

更新

使用 iloc。示例如下:

df.iloc[row, column] # accepts ints
Run Code Online (Sandbox Code Playgroud)

这将使您可以访问该列和行。

更新

因此,我们找到行索引,然后执行我最初的建议并获取整行。

row = df.loc[df['address_value']==lot_number].index[0]
df.iloc[row]
Run Code Online (Sandbox Code Playgroud)