I have a problem to delete specific rows from my dataframe. I want to delete rows that are by matching account number. Here is code:
def main():
# Collecting data from .csv
df1 = pd.read_csv("./2018/Member last activited.csv",
sep=";", dtype={"Account Number": str}, encoding='ISO-8859-1', engine = 'python')
accountnum = df1["Account Number"]
# Collecting data from .csv
df2 = pd.read_csv("./2019/Member last activited062019.csv",
sep=";", dtype={"Account Number": str, "Phone Number": str}, encoding='ISO-8859-1', engine = 'python')
accountnum2 = df2["Account Number"]
# comparing account numbers and removing them if matched
tmp2 = {"ID": "0",
"ACCOUNTNUM": "0"}
tmplist = []
for x, y in accountnum.items():
for z, w in accountnum2.items():
if y == w:
tmp2 = {"ID": z, "ACCOUNTNUM": w }
tmplist.append(tmp2)
index = 0
for x in df2["Account Number"]:
if x == tmplist[index]["ACCOUNTNUM"]:
df2.drop(index, inplace=True)
index += 1