import pandas as pd
import numpy as np
import random
import matplotlib.pyplot as plt
%matplotlib inline
#We are setting the seed to assure you get the same answers on quizzes as we set up
random.seed(42)
df=pd.read_csv(r'D:\数据分析\ABTEST\ab_data.csv')
df.head()
# 下面这句代码,展示的就是group=treatment且landing_page=old_page和group=control且landing_page=new_page,这样的错误行;
num_error = df[((df.group == "treatment")!=(df.landing_page == "new_page"))]
num_error.head(3)
# 去掉错误行后,再次查看是否还存在错误行
print("没有删除错误行之前的记录数:", df.shape