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-1.6.tar.gz
(16.5 kB
view details)
Built Distribution
coopio-1.6-py3-none-any.whl
(21.1 kB
view details)
File details
Details for the file coopio-1.6.tar.gz
.
File metadata
- Download URL: coopio-1.6.tar.gz
- Upload date:
- Size: 16.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a5a8df865641379164fe3392eec49233b9b09db58499e2405550b3d5e1966d5e |
|
MD5 | c91a73c17972e7f04c419b6de98afe7e |
|
BLAKE2b-256 | a830ab48c15daec40d72822c62ffb9a803293115154419842e6495f7d2c461e8 |
File details
Details for the file coopio-1.6-py3-none-any.whl
.
File metadata
- Download URL: coopio-1.6-py3-none-any.whl
- Upload date:
- Size: 21.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 519a66233d2e9c245b9863c5ee881d5638d7a2501de338f39458c5a33a6f2108 |
|
MD5 | 74bf52bcf0d141f15471dfda12a93428 |
|
BLAKE2b-256 | f0362deba7edc666b3707c1fdfbb1788e5b4e186c5c46b2b43c7a5994c4298c2 |