需求
剔除指定列中包含 “小計”信息的行。
解決
借助 pandas.DataFrame.filed.str.contains()
Step1:取出包含 “小計” 信息的行;
這樣,剩下的數據就都是不包含 “小計” 的數據了;
df[df['deliveryPrice'].str.contains('小計')]
Step2:取反
基於Step1取反;
這樣就拿到不包含 “小計” 的行;
df[~(df['deliveryPrice'].str.contains('小計'))]
Done.