|
|
|
|
@ -4,7 +4,8 @@ import re |
|
|
|
|
from abc import ABC, abstractmethod |
|
|
|
|
from dataclasses import dataclass |
|
|
|
|
from logging import warning, debug, error |
|
|
|
|
from pandas import DataFrame |
|
|
|
|
from pandas import DataFrame, Series |
|
|
|
|
import pandas as pd |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SAMPLE_EIN = "59-1571026" |
|
|
|
|
@ -75,6 +76,18 @@ class EINData: |
|
|
|
|
compareDict["score"] = score |
|
|
|
|
return compareDict |
|
|
|
|
|
|
|
|
|
def as_dict(self) -> dict: |
|
|
|
|
return {"BusinessName": self.buinessName, "Address1": self.address1, |
|
|
|
|
"City":self.city, "State": self.state, "Zip": self.zip, "Phone": self.phone} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def as_series(self) -> Series: |
|
|
|
|
""" |
|
|
|
|
Converts object into a pandas Series |
|
|
|
|
""" |
|
|
|
|
return Series(self.to_dict()) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def dataframe_to_eins(df: DataFrame, |
|
|
|
|
einLabel: str = "Lessee Tax-ID", |
|
|
|
|
@ -199,9 +212,12 @@ class EINTaxIDService(__EINService): |
|
|
|
|
data["phone"] |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
def search_eins(self, eins: str) -> list[EINData]: |
|
|
|
|
return [self.search_ein(ein) for ein in eins] |
|
|
|
|
|
|
|
|
|
def search_eins(self, eins: str, asDataFrame: bool = False) -> list[EINData]: |
|
|
|
|
if asDataFrame: |
|
|
|
|
dataList =[self.search_ein(ein).as_series() for ein in eins] |
|
|
|
|
return pd.concat(dataList, ignore_index=True) |
|
|
|
|
else: |
|
|
|
|
return [self.search_ein(ein) for ein in eins] |
|
|
|
|
|
|
|
|
|
def _parse_return(self, content: str) -> dict: |
|
|
|
|
""" |
|
|
|
|
|