I am writing a simple Contact Book app in Python using pandas and I want to add a function of removing a contact selected by used from a book. How can I do this? I tried pd.drop() function many times with different parameters but it did not work.
import pandas as pd
import numpy as np
import re
import csv
print("""Hello, that is app for Contact Book!
Use phone number format as 0516677699 tho
If you want to add contact, press ("A")
If you want to remove contact press ("R")
""")
contacts = pd.DataFrame(columns=["Name", "Phone Number"], index=range(1, 11) )
print(contacts)
operation = input("Do you want to enter contact book ? Press Y : ")
while operation == "Y":
oper1 = input("""What do you want to do?
A - add someone's contact
L - leave contact book
R - remove someone's contact
""")
if oper1 == "A" :
oper2 = input('Type his name : ')
oper3 = input('Type his number: ')
raw = {'Name': oper2,
'Phone Number': oper3}
contacts = contacts.append(raw, ignore_index=True)
if oper1 == 'L':
break
if oper1 == "R":
contacts.drop([contacts['Name'] == oper2, contacts['Phone Number'] == oper3])
print(contacts)
contacts_csv = []