本文翻译自:How to get a value from a cell of a dataframe?
I have constructed a condition that extract exactly one row from my data frame: 我构造了一个条件,可以从我的数据帧中准确提取一行:
d2 = df[(df['l_ext']==l_ext) & (df['item']==item) & (df['wn']==wn) & (df['wd']==1)]
Now I would like to take a value from a particular column: 现在,我想从特定列中获取一个值:
val = d2['col_name']
But as a result I get a data frame that contains one row and one column ( ie one cell). 但是结果是我得到一个包含一行一列( 即一个单元格)的数据帧。 It is not what I need. 这不是我所需要的。 I need one value (one float number). 我需要一个值(一个浮点数)。 How can I do it in panda