A simple, intuitive, pandas-based database.
Project description
datanest
A simple, intuitive, pandas-based database.
Perfect for handling data such as time series, images, or any Python objects alongside their metadata. This tool encapsulates a pandas DataFrame containing metadata and Python objects. It provides an intuitive data and metadata retrieval syntax through keyword-arguments.
Installation
pip install datanest
Usage
datanest.Database
is the core class that wraps a pandas.DataFrame
object. Even before adding any data fields using the add_data_field
method, the database can already be used to query rows from the encapsulated DataFrame with an intuitive keyword argument syntax.
import datanest
# Load example DataFrame with columns:
# participant_id (int), age (float), surgery_performed (bool), notes (str)
db = datanest.get_example_database()
# Retrieve all metadata
db()
# Retrieve metadata for participant 3
db(participant_id=3)
# Retrieve metadata for participants aged 50 to 60 who have not had surgery
db(age_lim=(50, 60), surgery_performed=True)
# Retrieve metadata for participants where the notes string contains the word interesting
db(notes_has='interesting')
The add_data_field
method can be used to add arbitrary python objects to the database, and we can retrieve relevant data entries using the same keyword argument syntax.
# Add heart rate data to the database, indexed by participant_id
db.add_data_field('heart_rate', datanest.get_example_data(), 'participant_id')
# Retrieve all heart rate time series data
db.heart_rate()
# Retrieve heart rate time series data for participant 3
db.heart_rate(participant_id=3)
# Retrieve heart rate time series for participants aged 50 to 60
db.heart_rate(age_lim=(50, 60))
# Retrieve heart rate time series for participants where the notes string contains the word interesting
db.heart_rate(notes_has='interesting')
License
datanest
is distributed under the terms of the MIT license.
Contact
Project Link: https://github.com/praneethnamburi/datanest
Acknowledgments
This tool was developed as part of the ImmersionToolbox initiative at the MIT.nano Immersion Lab. Thanks to NCSOFT for supporting this initiative.
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
Built Distribution
File details
Details for the file datanest-1.0.0.tar.gz
.
File metadata
- Download URL: datanest-1.0.0.tar.gz
- Upload date:
- Size: 13.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.28.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a5403387d6b2b5e7d37965cf9a8be88204a4f5baac23f063265e0ef54bf5c457 |
|
MD5 | 02b9bae7ee6532c4381c66f10192e1a7 |
|
BLAKE2b-256 | c5face6d6b2b97e76f31626f6d04b84171407712e0efa05c3f8ad42aa12ea708 |
File details
Details for the file datanest-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: datanest-1.0.0-py3-none-any.whl
- Upload date:
- Size: 7.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.28.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 42a26d0a341fb317bdd2552ccb05e5c44bbd6c97f8ea0b501d09edcd57c59459 |
|
MD5 | 46a2ea94f8e93cf60dc339c26df25ec3 |
|
BLAKE2b-256 | 76de6247ba9aec3d16470dc7b9064c0b0cfaf200e3576be6b00edc71895dfbb5 |