如何从数据框中提取值

时间:2017-11-21 01:23:40

标签: python pandas dataframe

enter image description here

如何提取最后一个值102.584855?我已经尝试了df[-1:].iloc[0],但它也将返回20。你怎么只得到102.58485?谢谢!

1 个答案:

答案 0 :(得分:4)

您可以使用:df.iloc[-1, 0]When 2 indexers are passed to iloc,第一个表示行的索引,第二个表示列的索引。因此Exception in Tkinter callback Traceback (most recent call last): File "C:\Python27\lib\lib-tk\Tkinter.py", line 1541, in __call__ return self.func(*args) File "C:\Snake\snake.py", line 18, in open_file call("C:") File "C:\Python27\lib\subprocess.py", line 168, in call return Popen(*popenargs, **kwargs).wait() File "C:\Python27\lib\subprocess.py", line 390, in __init__ errread, errwrite) File "C:\Python27\lib\subprocess.py", line 640, in _execute_child startupinfo) WindowsError: [Error 5] Access is denied 选择最后一行和第一列中的值。

或者,df[-1:].iloc[0].item() would also work,但效率较低。