drop函数: 删除列(axis=1),删除行(axis=0)
import pandas as pd
df=pd.read_excel("Print pack disconnection record.xlsx")
df=df.drop(["Printer"],axis=1) #axis=1 表示删除列;
df=df.drop([3],axis=0) #axis=0 表示删除行;
print(df.head())
df.to_excel("Pack断连.xlsx")
df["列名"].value_counts(): 查看某一列的数值出现次数
print(df["Pack"].value_counts())
如果需要查看百分百,normalize=True
print(df["Pack"].value_counts(normalize=True))
获取某列的非重复值(唯一值)unique()
print(df["Pack"].unique())
isin([a,b])查看某一列或者整个表是否包含a或者b。
print(df["Date"].isin([4,5]))