import pandasdata = pandas.read_csv("Source_Sheet.csv")data1 = pandas.read_csv("Target sheet.csv")#print(data.dtypes)data1["permanent address"] = data["Permanent Address"]data1["delhi address"] = data["Delhi Address"]name_party_area = data["Name of Member \nParty \nConstituency(State)"].str.split('\n')name = []party = []area = []state = []for n in name_party_area: name.append(n[0])for p in name_party_area: party.append(p[1])for a in name_party_area: try: temp = a[2] k = temp[0:temp.find("(")] area.append(k) l = temp[temp.find("(")+1:-1] state.append(l) except: passdata1["name"] = pandas.Series(name)data1["organisation"] = pandas.Series(party)data1["Area"] = pandas.Series(area)data1["State"] = pandas.Series(state)email_phone = data["Email Address \nTelephone Nos."].str.split('\n')#print(email_phone[0])sansad_email = []email = []for item in email_phone: try: if "@" in item[0]: if "@sansad.nic.in" in item[0]: sansad_email.append(item[0]) if "@" not in item[1]: email.append("NA") else: email.append(item[0]) sansad_email.append("NA") else: sansad_email.append("NA") email.append("NA") if "@" in item[1]: email.append(item[1]) except: pass number = data["Permanent Telephone No."]nos = []sec_nos = []for num in number: try: d = num.rfind("(M)") g = num[d-11:d] nos.append(g) except: nos.append("NA") try: j = num.find("ax") h = num[j+5:j+18] sec_nos.append(h) except: sec_nos.append("NA")这是我的方法,但我没有得到预期的结果。此外,输出仅显示 9 行,而本应返回 403 行。我在提取永久手机号码和辅助手机号码时遇到问题。csv 文件的链接是 - https://drive.google.com/open?id=1pXXwE-QjmKc_PH8EFkH9ZhejwZc8QY6v
添加回答
举报
0/150
提交
取消