Library for creating data services
Project description
coopio
Library for creating data services
CsvDataService Example:
class Dummy:
def __init__(self, a, b, c):
self.a = a
self.b = b
self.c = c
def __str__(self):
return f"a: {self.a}, b: {self.b}, c: {self.c}"
def __repr__(self):
return self.__str__()
class CsvDataService_Dummy(ICsvDataService):
def __init__(self, data_file_path: str):
ICsvDataService.__init__(self, data_file_path)
def translate_from_data_rows(self, df: pd.DataFrame) -> List[T]:
ret_dummies = []
for i, row in df.iterrows():
new_dummy = Dummy(
a=row['a'],
b=row['b'],
c=row['c']
)
ret_dummies.append(new_dummy)
return ret_dummies
After Establishing the data service, data can be stored or retrieved as follows:
dummies = []
for ii in range(0, 5):
dummies.append(Dummy(ii, 2, 3))
data_service.add_or_update(obj_identifier='a', objs=dummies)
stored = data_service.retrieve_data(obj_identifier='a')
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
coopio-0.16.tar.gz
(3.4 kB
view details)
Built Distribution
coopio-0.16-py3-none-any.whl
(5.1 kB
view details)
File details
Details for the file coopio-0.16.tar.gz
.
File metadata
- Download URL: coopio-0.16.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 16e9cc8c07b2e2fa1aff6fe1d7ddcf822ff05d16860a8ed6e1fa4ec7a4aae552 |
|
MD5 | c3aa9dd177790d6d3b0df82c5d72ea11 |
|
BLAKE2b-256 | 462a6b241a1eafeb40756104191e94fe619d8d975e8420438b5cf4b5d1288b08 |
File details
Details for the file coopio-0.16-py3-none-any.whl
.
File metadata
- Download URL: coopio-0.16-py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 49e2cbec7e9108eeb68eb243850c30655dca5a4c9b82da3d7e11fb158d571a45 |
|
MD5 | cfdb3d97fd84c42e65c64dc8408a868f |
|
BLAKE2b-256 | 13fba6b92622f6e570c13a6885643b73fbb1759d64cbfb13d5e6590806aadde9 |