https://github.com/deepcharles/database
Miscellaneous classes I use to store data
https://github.com/deepcharles/database
Last synced: over 1 year ago
JSON representation
Miscellaneous classes I use to store data
- Host: GitHub
- URL: https://github.com/deepcharles/database
- Owner: deepcharles
- License: gpl-3.0
- Created: 2016-06-02T08:55:32.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2016-06-02T09:15:40.000Z (about 10 years ago)
- Last Synced: 2025-01-30T08:31:00.937Z (over 1 year ago)
- Language: Python
- Size: 15.6 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# database
Miscellaneous classes I use to store data
## Examples
### class Signal
```python
import numpy as np
from signal_class import Signal
s = Signal(np.arange(10), color="black", label="iris")
print(s.color) # black
print(s.label) # iris
print(s.mean().color) # black
print(s[1:6].label) # iris
print(s._meta) # ['color', 'label']
```
### class Database
```python
from database import Database
class Apple:
def __init__(self, color):
self.color = color
db = Database([Apple("green"), Apple("red"), Apple("blue"), Apple("red")])
# db acts like a list
print(len(db))
print(db[-1].color)
print([a.color for a in db[1:3]])
print(list(db.groupby("color")))
```