Skip to main content

Simple module to store data with arbitrary structure in dict or Pandas DataFrame

Project description

Do you collect a heterogeneous data step by step?

Here you find a convinient solution of this problem. class AccumulativeData provides a simple interface to store data step by step. The data can be consisted of:

  1. Numbers
  2. Lists / arrays
  3. Objects

You can store it as pickled object or Pandas Dataframe.

Installation

The module can be installed from pip

pip install accudata

For example

You have a social data collecting process. You must collect on every step heterogeneous data:

  1. Name of a person
  2. Age
  3. Interests
  4. Preferences by categories: food, pets, sport, politics

You can make a class:

from accudata import AccumulativeData

class PeopleAccData(AccumulativeData):
	def __init__(self):
		lists = ['name', 'age', 'interests']
		dicts = {'pref': ['food', 'pets', 'sport', 'politics]}
		super().__init__(lists=lists, dicts=dicts)

After that you can make an iterative collecting process as follows:

Data = PeopleAccData()
for item in raw_data:
	Data.next()
	# \\\ A complicated code to extract data
	name, age, interests, food, pets, sport, politics, _ = extract_data(item)
	Data.append(name, age, interests,
		    pref=[food, pets, sport, politics])
	

It is simple to get data:

names = Data.name
# Make the dataframe
dataframe = Data.todf()
print(dataframe.name)

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

accudata-1.0.1.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

accudata-1.0.1-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file accudata-1.0.1.tar.gz.

File metadata

  • Download URL: accudata-1.0.1.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.5

File hashes

Hashes for accudata-1.0.1.tar.gz
Algorithm Hash digest
SHA256 df800255dc252bf63937b0094453bdaf65e09772c3f51d808b9cd44d814d9cfd
MD5 e7dcf63b818a21b8f44d47dc277c39bb
BLAKE2b-256 9338f80ba4e4167141e71cb74e927c341762dfab547c3de828af1fb7d13eb8af

See more details on using hashes here.

File details

Details for the file accudata-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: accudata-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 3.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.5

File hashes

Hashes for accudata-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 199daf344ac0c83c1b3f0245973f6457b060a0661b609e22a69d427157a7d9b9
MD5 51cc74b67dd8bcdaa286a6b021fefbb1
BLAKE2b-256 b81d116cc658a72e27bf5c6381b6733f4af14797dc719e1bcc955614cef45b68

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