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.5.tar.gz
(32.8 kB
view hashes)
Built Distribution
Close
Hashes for tworavens_preprocess-1.1.5.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | dfde367efe18371fb6221cb9ea4f4269d1c4c42b59af0bcc8e472360bb59dfa8 |
|
MD5 | 0850f5f36705665734acbba4ea35f75b |
|
BLAKE2b-256 | 54ddc11ea8d926951de330f87c52d8f69b83a3afd7364f441c36c95357c77dc0 |
Close
Hashes for tworavens_preprocess-1.1.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9fcb2350e0667e851674893ed95884545cf2a4ee246608086fe677c5a905f4e8 |
|
MD5 | 2560ed6311cc5464c22c3218d968351c |
|
BLAKE2b-256 | 60cc988e1d38fd601c05be8c38838f4b0e7819b38d7813609eb0a583dfc01cec |