首页 » Python » python基础知识:pandas基础series

python基础知识:pandas基础series

 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import pandas as pd
s = pd.Series([1,2,3,4])
print(s)
print("==================")
s1= pd.Series([1,2,3,4],index= ["a","b","c","d"])
print(s1)
print(s[0])
print(s1["a"])
print(s1[["a","c"]])
print("===========")
s1["e"] = 6
print(s1)
d = {'qinlu':'hand','lulu':'smart'}
print(d)
s3 = pd.Series(d,index=['qinlu','lulu','qinqin'])
print(s3)
print(s1.astype(str))

s1['a'] = 'a'
print(s1)

原文链接:python基础知识:pandas基础series,转载请注明来源!

0