TwoRavens Preprocess package
Project description
TwoRavens Preprocess
Python package to produce TwoRavens metadata:
pip install tworavens-preprocess
Preprocess a data file
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-0.9.tar.gz
(25.3 kB
view hashes)
Built Distribution
Close
Hashes for tworavens_preprocess-0.9-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f7f9a073539fe90f75e6a48e79856947c0bd0520e78405155322295a95108073 |
|
MD5 | b7fca48e34f1fe9572ed43a24b83881f |
|
BLAKE2b-256 | abddd5073e84b0b21f1d363f90158ef95e4ab5f884ceb97c1c961cb472edcd22 |