python中pandas库的作用_python之pandas库详解

pandas 是一个 Python Data Analysis Library.在使用前 import pandas as pd

一.创建对象(产生数据)

pandas 中有三种基本结构:

Series:1D labeled homogeneously-typed array

DataFrame:General 2D labeled, size-mutable tabular structure with potentially heterogeneously-typed columns

Panel:General 3D labeled, also size-mutable array

1.Series

Series 是一维带标记的数组结构,可以存储任意类型的数据(整数,浮点数,字符串,Python 对象等等)。

作为一维结构,它的索引叫做 index,基本调用方法为s = pd.Series(data, index=index)。

data 可以是以下结构:

ndarray

(1)字典:如果 data 是个 dict,如果不给定 index,那么 index 将使用 dict 的 key 排序之后的结果,如果给定了 index,那么将会按照 index 给定的值作为 key 从字典中读取相应的 value,如果 key 不存在,对应的值为 NaN(not a number, Pandas 中的缺失默认值)

d = {‘a’ : 0., ‘b’ : 1., ‘c’ : 2.}

pd.Series(d)<

Original: https://blog.csdn.net/weixin_39835158/article/details/112925962
Author: weixin_39835158
Title: python中pandas库的作用_python之pandas库详解

原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/674439/

转载文章受原作者版权保护。转载请注明原作者出处!

(0)

大家都在看

亲爱的 Coder【最近整理,可免费获取】👉 最新必读书单  | 👏 面试题下载  | 🌎 免费的AI知识星球