Repository URL to install this package:
|
Version:
1.0.9 ▾
|
namara-er
/
METADATA
|
|---|
Metadata-Version: 2.1
Name: namara-er
Version: 1.0.9
Summary: A Python ER Client for Namara
Home-page: https://thinkdataworks.com
Author: Thinkdata Works
Author-email: info@thinkdataworks.com
License: UNKNOWN
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.6
Description-Content-Type: text/markdown
Requires-Dist: requests
Requires-Dist: requests-mock
Requires-Dist: pandas
Requires-Dist: pytest
Requires-Dist: protobuf
Requires-Dist: Werkzeug
Requires-Dist: blinker
# namara-er
Python ER Client for Namara
## Installation
Install the `namara-er` package by running the following command:
```
pip3 install --extra-index-url https://1ibk87-07zyVmogrokAbDQGShOSxniQXY:@pypi.fury.io/thinkdataworks/ namara-er==1.0.8
```
## Usage
To use the Namara ER Service, use the `Client` object. For API access, please contact info@thinkdataworks.com to obtain your API key.
```
from namara_er.client import Client
client = Client(
api_key='my_namara_api_key'
)
resolved_entities = client.get_entities(entity_type='business', entities=['Google LLC', 'Goo gle', 'ACME', 'ACME Corp'])
print(resolved_entities)
{'entities': [
{'input_value': 'Google LLC',
'norm_value': 'google',
'code': '6442fda409',
'entity_type': 'business'},
{'input_value': 'Goo gle',
'norm_value': 'goo gle',
'code': '6442fda409',
'entity_type': 'business'},
{'input_value': 'ACME',
'norm_value': 'acme',
'code': '5bae1fb64b',
'entity_type': 'business'},
{'input_value': 'ACME Corp',
'norm_value': 'acme',
'code': '5bae1fb64b',
'entity_type': 'business'}]}
```
You can use a built-in helper function to append unique codes to a dataset column.
The input dataset must be a pandas DataFrame object.
```
import pandas as pd
# In this example, resources/test.csv contains below:
#
# Name
# thinkdataworks
# Apple Co.
# APPLE
# ThinkData Works
df = pd.read_csv('resources/test.csv', dtype=str)
result_df = client.append_codes(df=df, col_name='Name')
print(result_df)
Name Name_id
0 thinkdataworks 789ded6ebd
1 Apple Co. 9c0b571766
2 APPLE 9c0b571766
3 ThinkData Works 789ded6ebd
```
To point to a specific `api_url`, you can add a second argument to the client like this:
```
client = Client(
api_key='my_namara_api_key',
api_url='er_api_url'
)
```
For access with specific `er_api_url`, please contact info@thinkdataworks.com.