Import numpy as np
Import pandas as pd

Series:
Series是一维标记的数组,能够保存任何数据类型(整数,字符串,浮点数,Python对象等)。轴标签统称为索引。创建系列的基本方法是调用:

s = pd.Series(data, index=index)

这里的index的个数要和data长度相等,因为要为每一个data都匹配一个index
假如没有设定index,则会默认从0开始分配。

对于存储不同的数据有:
数组Ndarray:
初学Pandas--Series存储不同类型对象的数据结构
对于上述Ndarray数据如果创建时不允许index的个数比数组元素还多

字典dict:
初学Pandas--Series存储不同类型对象的数据结构

标量scalar:
如果data是标量值,则必须提供索引。将重复该值以匹配索引的长度。
初学Pandas--Series存储不同类型对象的数据结构

相关文章:

  • 2021-07-30
  • 2022-12-23
  • 2022-12-23
  • 2021-07-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-05
  • 2022-12-23
猜你喜欢
  • 2022-02-10
  • 2021-09-20
  • 2021-10-07
  • 2021-11-28
  • 2021-12-21
  • 2021-05-17
  • 2021-11-22
相关资源
相似解决方案