1.pandas :
(1)官网:https://pandas.pydata.org/
(2)概述:
pandas is a fast, powerful, flexible and easy to use open source data analysis and manipulation tool,
【pandas就是一个数据分析的工具】
(3)编程模型【数据类型】
1.Series
2.DataFrame
2.Series
(1)Series is a one-dimensional labeled array
【Series 就是一个 一维 标签数组】
(2)capable of holding any data type 【integers, strings, floating point numbers, Python objects, etc.).】
【存各种数据类型】
(3)The axis labels are collectively referred to as the index
标签 就是索引 【可以用索引 取Series元素】
实例化:
3.df
(1)DataFrame is a 2-dimensional labeled data structure with columns of potentially different types
【DataFrame 就是一个 二维 标签数组,多个不同数据类型的列】
【 index (row labels) and columns 】
【【DataFrame就是一个table 有行有列】
(2)如何创建df :
Dict of 1D ndarrays, lists, dicts, or Series
2-D numpy.ndarray
Structured or record ndarray
A Series
Another DataFrame
【df 可以由多种数据 转化而来】
(3)a dict of Series objects
df =》 table =》 有行有列
DataFrame = DataFrame【Series】
实例化:
4.总结:
(1)df 就是table
(2)Series 是一个table 就一个列 没有列名
(3)df = df [Series + 列名]
5.df 基本操作:(具体使用参考官网)
(1)数据加载
(2)处理的数据文件格式:
csv json text :结构化数据
csv: 按逗号进行分割 =》 excel打开的
json: kv
text:普通文本数据
(3)数据拼接:
table:union(concat)、union all、join(merge)
(4)切片:取值
(5)取字段 :filter
(6)条件过滤:where
(7)空值处理:dropna(去除空值)、fillna(替换空值)
(8)排序:orderby 、sort by
(9)分组聚合:groupby、count
4.思考:
数据分析师 拿到一个数据一般做哪些事情? 【大数据工程师也是一样】
1.数据加载 source
2.数据分析 transform
3.数据输出 sink