Skip to main content

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


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.11.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

coopio-0.11-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file coopio-0.11.tar.gz.

File metadata

  • Download URL: coopio-0.11.tar.gz
  • Upload date:
  • Size: 3.2 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

Hashes for coopio-0.11.tar.gz
Algorithm Hash digest
SHA256 296fd3f82fd15b0ac668b0766a6e39189377cec5c6e46251c80eabaf7e1d06dd
MD5 6520d5e16c5c6e5a1b7d96c1c5ec13cc
BLAKE2b-256 0843e9ac0e70a07ab1a429e520ddd9a5d20d0dd0eacc7e162440f051e287a30c

See more details on using hashes here.

File details

Details for the file coopio-0.11-py3-none-any.whl.

File metadata

  • Download URL: coopio-0.11-py3-none-any.whl
  • Upload date:
  • Size: 5.0 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

Hashes for coopio-0.11-py3-none-any.whl
Algorithm Hash digest
SHA256 fe4bade0aa3c7ac12a55dd4ffa90ab52f036ac6bf071702629dcb435250ea5a0
MD5 12782837c55f2b96bac7185c1241e00b
BLAKE2b-256 c64922fc8fac01080655022605832c95c5bf7998d7b513cf1cc034bb8b63cf93

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page