2017-05-09 32 views
2

下面我列出了我的对象countiespop返回的内容以及对象的类型。我无法找到一种专门创建3'STNAME'的系列方法。在python熊猫中编制一系列的索引

countiespop 

Returns 
STNAME 
California 15924150 
Texas   8269632 
Illinois  6815061 
Name: CENSUS2010POP, dtype: int64 

type(countiespop)

返回 pandas.core.series.Series

+0

谢谢编辑!这是我的第一篇文章! –

回答

5

这是你所追求的?

#create a series using the index of the current Series 
pd.Series(countiespop.index) 
Out[274]: 
0 California 
1   Texas 
2  Illinois 
Name: a, dtype: object 
+1

我想你在解释OP的猜测是正确的:-) – piRSquared

+0

:-)让我们来看看。我可能完全错了! – Allen

+0

这就像是一个守门员......你必须猜测并去用它。 – piRSquared