Pandas series name

对着背影说爱祢 提交于 2020-02-02 05:42:06

问题


I am trying to name my series "Points" but it is not showing up as Points.

Points = pd.Series([1,2,3])

print(Points.name)
output: None

I even tried renaming it but it still shows "None"

Points.rename("Points")
print(Points.name)
output: None

What am i doing wrong?


回答1:


Points is your variable assigned the your series.

Points = Points.rename("Points")

Not "s" in the above example.

print(Points)

0    1
1    2
2    3
Name: Points, dtype: int64

and

print(Points.name)

'Points'


来源:https://stackoverflow.com/questions/46120478/pandas-series-name

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!