Object-oriented pandas DataFrame mapper.
Project description
THIS IS EXPERIMENTAL.
Requirements
Python 3.5+
Pandas 0.20.0+
Installation
Install DataFrame Mapper via pip:
$ pip install dataframe-mapper
Example
Simple DataFrame Mapper example:
from dfmapper import DataFrameMapper, IntColumn, StrColumn
class UserDfm(DataFrameMapper):
id = IntColumn(min=1, nullable=False)
username = StrColumn(max_length=30, nullable=False)
profile = StrColumn()
def find_by_id(self, id):
return self.df[self.df.id == id]
user_dfm = UserDfm({
"id": [1, 2, 3],
"username": ["Bessie Bennett", "Sandra Matthews", "Jessie Bates"],
"profile": ["BLAH BLAH BLAH", "PITH PITH PITH", None]
})
user_dfm.is_valid()
#: True
user_dfm.find_by_id(1)
#: id username profile
#: 0 1 Bessie Bennett BLAH BLAH BLAH
License
DataFrame Mapper is licensed under MIT License. See LICENSE for more information.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dataframe-mapper-0.0.3.tar.gz.
File metadata
- Download URL: dataframe-mapper-0.0.3.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d3a04d0daf28a212d7fc8f96da73642c0dd9db959f613bd5054b8d1b780212b9
|
|
| MD5 |
5386f3928c495827ddea4d80ceec51f9
|
|
| BLAKE2b-256 |
e5a94ba8ea5d597d1901dcbdbf07c99a2840ffa6b7f7729bbc5c9bf701d5a548
|
File details
Details for the file dataframe_mapper-0.0.3-py3-none-any.whl.
File metadata
- Download URL: dataframe_mapper-0.0.3-py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
440f4116990076490ce4bd29bb7fc373d390a8477eb1985c8e05068b24c5dda8
|
|
| MD5 |
fb466d707d40421417d48a148f3b3e64
|
|
| BLAKE2b-256 |
b75820cce8519337744ff386b98b846c4649c1db65b732a639f96416ae5182c3
|