1
Usage Guide
Griffiths Lott edited this page 3 years ago
Sample Basic Usage
Import the EIN service you plan to use and search for an EIN:
from EINService import EINTaxIDService
# Instatiate an EINService object
# This is what will be used to do all of our searches
einService = EINTaxIDService()
# Advanced Micro Devices Inc's EIN identifier:
# This is the ein we will be searching.
AMD_EIN = "94-1692300"
# The return will be an EINData object
# If the search was unsuccessful data members other than EIN will be None
searchResult = einService.search_ein(AMD_EIN)
print(searchResult)
# EIN: 941692300 | Name: advanced micro devices inc | Address: 2485 augustine drive | City: santa clara | State: ca | Phone: 408 7494000
Using with Excel/pandas
You can also process lists of EINs or entire sets of EINData Objects. There is also a function to convert a dataframe into a list of EINData for easy comparison with search results:
from EINService import EINTaxIDService, dataframe_to_eins
import pandas as pd
# Instatiate an EINService object
# This is what will be used to do all of our searches
einService = EINTaxIDService()
# Here we pull in the data from excel
einData = pd.read_excel("SampleData.xlsx")
# Extract the eins column as a list of strings
einList = einData["Lessee Tax-ID"].to_list()
# The service will return a list EINData objects
# if no match what found all data members besides ein will be None
searchResults = einService.search_eins(einList)
print(searchResults)
# Can also convert a dataframe into a list of EINData
# The requires that our dataframe has all of the nessary columns.
# The defaults for these columns are:
# "Lessee Tax-ID",
# "NAME",
# "ADDRESS"
# "CITY"
# "STATE"
# "ZIP"
# "PHONE"
#
# You can also specify your own column names as paramaters.
einDataList = dataframe_to_eins(einData)
print(einData)
# This allows us to compare our search results to our 'local data'
for i, localData in enumerate(einDataList):
comparisonDict = localData.compare(searchResults[i])
print(comparisonDict)
Note: this library has built-in logging with debug, warning and error information. Include --logging-level=DEBUG to access this infromation.