Pandas series name

2019-05-15 06:20发布

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条回答
太酷不给撩
2楼-- · 2019-05-15 06:24

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'
查看更多
登录 后发表回答