2020-06-02
閱讀量:
1135
pandas中Series的創(chuàng)建方式
Series序列的創(chuàng)建主要有三種方式:
1)通過一維數(shù)組創(chuàng)建序列
import
numpy
as
np,
pandas
as
pd
arr1
=
np.arange(10)
arr1
type(arr1)
s1
=
pd.Series(arr1)
s1
type(s1)
2)通過字典的方式創(chuàng)建序列
dic1
=
{'a':10,'b':20,'c':30,'d':40,'e':50}
dic1
type(dic1)
s2
=
pd.Series(dic1)
s2
type(s2)
3)通過DataFrame中的某一行或某一列創(chuàng)建序列






評論(0)


暫無數(shù)據(jù)
推薦帖子
0條評論
0條評論
3條評論