TwoRavens Preprocess package
Project description
TwoRavens Preprocess
Python package to produce TwoRavens metadata:
pip install tworavens-preprocess
Preprocess a data file
- Open a python shell
from raven_preprocess.preprocess_runner import PreprocessRunner
# process a data file
#
run_info = PreprocessRunner.load_from_file('input/path/my-data-file.csv')
# Did it work?
#
if not run_info.success:
# nope :(
#
print(run_info.err_msg)
else:
# yes :)
#
runner = run_info.result_obj
# show the JSON (string)
#
print(runner.get_final_json(indent=4))
# retrieve the data as a python OrderedDict
#
metadata = runner.get_final_dict()
# iterate through the variables
#
for vkey, vinfo in metadata['variables'].items():
print('-' * 40)
print(f'--- {vkey} ---')
print('nature:', vinfo['nature'])
print('invalidCount:', vinfo['invalidCount'])
print('validCount:', vinfo['validCount'])
print('uniqueCount:', vinfo['uniqueCount'])
print('median:', vinfo['median'])
print('etc...')
Preprocess a single file: output to screen or file
# -------------------------
# Preprocess a single file,
# Write output to screen
# -------------------------
from raven_preprocess.preprocess import run_preprocess
run_preprocess('path-to-input-file.csv')
# -------------------------
# Preprocess a single file,
# Write output to file
# -------------------------
from raven_preprocess.preprocess import run_preprocess
run_preprocess('path-to-input-file.csv', 'path-to-OUTPUT-file.csv')
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
tworavens_preprocess-1.1.3.tar.gz
(31.6 kB
view hashes)
Built Distribution
Close
Hashes for tworavens_preprocess-1.1.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4f8f74a56a40d7707029060c9d029a528265ef2764c5e24f7887503e06de5342 |
|
MD5 | 5919f08b3dcc848518f729c2ff7badbf |
|
BLAKE2b-256 | 12558c6de71051f6397c24d278fda824fb83dfb7d0e8f13f641019e13aba00fc |
Close
Hashes for tworavens_preprocess-1.1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e5e24f8db80a6517b7a79194e1fd8a9c625218aa268300e9015880cbc8a1ec1d |
|
MD5 | 3862f1156260b9e44bf9d17b93b6debd |
|
BLAKE2b-256 | 0deaec9407ce7eacbce427863ec5a4c81e9b03ccf84db54c1f136d37c86419de |