pandas.Series
pandas.Series(data=None, index=None, dtype=None, name=None, copy=False, fastpath=False)
Parameters
| data | 存储在Series中的数据。如果data是dict,则保持参数顺序。 |
|---|---|
| index | 值必须是可散列的并且与数据具有相同的长度。 允许非唯一索引值。 如果data是dict-like并且index是None,那么数据中的键被用作索引。 如果索引不是None,则使用索引值重新生成索引。 |
| dtype | 输出的数据类型 |
| name | 赋予Series的名称 |
| copy | 是否复制输入数据 |
Example
import pandas as pdpd.Series({"site": "google", "age": 18, "color": "red"})----------------------------------------------------------site googleage 18color reddtype: object
Example
import pandas as pdpd.Series([1,2,3], index=["x", "y", "z"], name="num_list", dtype="float64")----------------------------------------------------x 1.0y 2.0z 3.0Name: num_list, dtype: float64
