pandas 如何检索pandas Series对象中第n个元素的值?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/36710702/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to retrieve value of n-th element in pandas Series object?
提问by Moppentapper
I have a series object (1 column of a DataFrame
) and would like to extract the value of the first element. Is there a way to do this simply without converting to a list and without knowing the key? Or is the only way to access it by converting it to a list first using tolist()[n]
?
我有一个系列对象( a 的 1 列DataFrame
)并想提取第一个元素的值。有没有办法在不转换为列表且不知道密钥的情况下简单地做到这一点?或者是通过首先使用将其转换为列表来访问它的唯一方法tolist()[n]
?