From bd79683d46112cd0fa663ad00cf3fbdf4fbce055 Mon Sep 17 00:00:00 2001 From: Griffiths Lott Date: Thu, 12 Jan 2023 14:41:24 -0500 Subject: [PATCH] Fixed as_series() method and simplified compare() logic --- EINService.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/EINService.py b/EINService.py index 2bd88ea..902916e 100644 --- a/EINService.py +++ b/EINService.py @@ -56,13 +56,14 @@ class EINData: """ try: compareDict = { - # Tenary operator used ot concisley assign values - # If they match then true, else false - "buinessName" : True if self.buinessName == otherEIN.buinessName else False, - "address" : True if self.address1 == otherEIN.address1 else False, - "city": True if self.city == otherEIN.city else False, - "state": True if self.state == otherEIN.state else False, - "zip" : True if self.zip == otherEIN.zip else False + # Checks wether these two data points match + # Thanks to the standardiztion provided by EINData's init + # there should be few matching issues + "buinessName" : self.buinessName == otherEIN.buinessName, + "address" : self.address1 == otherEIN.address1, + "city": self.city == otherEIN.city, + "state": self.state == otherEIN.state, + "zip" :self.zip == otherEIN.zip } except Exception as e: error(f"""Exception:\n{e}\nSelf:{self}\nOther: {otherEIN}\n""") @@ -85,7 +86,7 @@ class EINData: """ Converts object into a pandas Series """ - return Series(self.to_dict()) + return Series(self.as_dict()) @@ -243,6 +244,7 @@ class EINTaxIDService(__EINService): addressPieces = address.split(',') address1 = addressPieces[0].strip() city = addressPieces[1].strip() + # State and Zip are only seperated by a space not a ',' state = addressPieces[2].strip().split(" ")[0].strip() zip = addressPieces[2].strip().split(" ")[1].strip() else: