Pandas dataframes to DDF packages.
Project description
Frame2Package
A helper library for converting Pandas dataframes to DDF packages.
Usage
import pandas as pd
import io
from frame2package import Frame2Package
# Load some sample data
data = """area year age education distribution
Bahamas 2000 15+ Total 1.0
Fiji 1970 80+ Total 1.0
Gabon 2025 20--64 Under 15 0.0
Brunei Darussalam 2045 All Total 1.0
Thailand 1985 15+ Upper Secondary 0.07
"""
df = pd.read_csv(io.StringIO(data), sep='\t')
# Specify all the concepts in the dataset
# as per the DDF data format specification.
concepts = [
{
'concept': 'area',
'concept_type': 'entity_domain'
},
{
'concept': 'year',
'concept_type': 'time'
},
{
'concept': 'age',
'concept_type': 'string'
},
{
'concept': 'education',
'concept_type': 'entity_domain'
},
{
'concept': 'distribution',
'concept_type': 'measure'
},
]
# Initialize a Frame2Package object
f2p = Frame2Package(data=df, concepts=concepts)
# Save the package
f2p.to_package('sample-dataset')
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
frame2package-0.0.1.tar.gz
(3.0 kB
view details)
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 frame2package-0.0.1.tar.gz.
File metadata
- Download URL: frame2package-0.0.1.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.7.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
86f0a39d1482fbbe2f029f4466ef57ee1a5eaf7cf01ba144ed99db4c8f95d026
|
|
| MD5 |
c9a02e73b4b4b26247d9f025c7cc21fd
|
|
| BLAKE2b-256 |
582ffe08e69d793fa88631d2478dac691182251112ef03766ee8f678a63d9cc3
|
File details
Details for the file frame2package-0.0.1-py3-none-any.whl.
File metadata
- Download URL: frame2package-0.0.1-py3-none-any.whl
- Upload date:
- Size: 3.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.7.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e217f969260bee2c4a818c694244401abf18831a05e8e6ac787965c6f0b4ea34
|
|
| MD5 |
cf17462a2b90a669d0fd8c561da90b8c
|
|
| BLAKE2b-256 |
d780b898f92fd4a490bd3a92706a302ede91fa0611ae253a70823115bc3655cd
|