一文看懂pandas中的透视表
import pandas as pd
import numpy as np
df = pd.read_excel("./sales-funnel.xlsx") # 当前目录下的文件
df.head()
使用category数据类型,按照想要查看的方式设置顺序
不严格要求,但是设置了顺序有助于分析,一直保持所想要的顺序
df["Status"] = df["Status"].astype("category")
df["Status"].cat.set_categories(["won","pending","presented","declined"],inplace=True) # 设置顺序pd.pivot_table(df,index=["Manager","Rep"]) # index表示索引


4.使用columns参数,指定生成的列属性






当通过透视表生成了数据之后,便被保存在了数据帧中
查询指定的字段值的信息

