Skip to main content

A variety of smart tools to make analytics easy

Project description

Dissector

Using the dissector command-line tool

dissector.exe is a command-line tool to analyze CSV files. The input file can be a single file or files from a directory dir that have a common column separator sep. The dissected results can be generated in the form of an excel file (xlsx) or text (json or csv). By default, the analysis is run on the entire content of the file i.e., without any filters. But slicers help slice data and run analysis. The output gives the following information for each column element in the input file(s).

  • column: column name.
  • strlen: minimum and maximum string length.
  • nnull: count of NANs and empty strings.
  • nrow: number of rows.
  • nunique: number of unique values.
  • nvalue: number of rows with values.
  • freq: frequency distribution of top n values. n is configured in dissector_config.yaml.
  • sample: a sample of top n values. n is configured in dissector_config.yaml.
  • symbols: non-alphanumic characters that are not in [a-zA-Z0-9]
  • n: column order.
  • filename: name of the input file from where the column was picked.
  • filetype: file type to which the file is associated to (e.g., csv).

The output also presents other additional info:

  • slice: The slice used to select. Slices represents filter conditions to select subsets of rows within a dataset.
  • timestamp: file modified date timestamp of the input file.
  • hash: md5 hash of the input file.
  • size: file size of the input file in bytes.
usage: dissector.exe [-h] [--to {xlsx,json,csv}] [--sep SEP]
                    [--slicers [SLICERS ...]] [--nsample NSAMPLE]
                    [--outfile OUTFILE] [--config CONFIG]
                    dir file

positional arguments:
  dir                   Input directory
  file                  Input file (for multiple files use wildcard)

optional arguments:
  -h, --help            show this help message and exit
  --to {xlsx,json,csv}  Save result to xlsx or json or csv (default: xlsx)
  --sep SEP             Column separator (default: ,)
  --slicers [SLICERS ...]
                        Informs how to slice data (default: for no slicing)
  --nsample NSAMPLE     Number of samples (default: 10)
  --outfile OUTFILE     Output file name (default: dissect_result)
  --config CONFIG       Config file for meta data (default:
                        `.\config\dissector_config.yaml`)

Ensure that a yaml config file is present at .\config\dissector_config.yaml in relation to dissector.exe prior to executing the command.

---
read_csv:
  skiprows: 0
  skipfooter: 0
  engine: 'python' # {'c', 'python', 'pyarrow'}
  encoding: 'latin-1' # {'utf-8', 'latin-1'}
  quotechar: '"'
  on_bad_lines: 'warn' # {'error', 'warn', 'skip'}
  dtype: 'str'
  keep_default_na: false

Examples

Fetch *.csv from .\temp and dissect them with , as column separator.

dissector .\temp *.csv -s ,

Fetch myfile.text from c:\temp and dissect the file with ; as column separator.

dissector c:\temp myfile.text -s ;

Fetch myfile.text from c:\temp and dissect the file with ; as column separator by slicing the data with a filter on COLUMN1 == 'VALUE' and also without filtering any.

dissector c:\temp myfile.text -s ; --slicers "" "COLUMN1 == 'VALUE'"

Fetch myfile.text from c:\temp and dissect the file with TAB \t as column separator by slicing the data with a filter on a column name that has a space in it COLUMN 1 == 'VALUE'.

dissector c:\temp myfile.txt -sep ';' --slicers "" "`COLUMN 1` == 'VALUE'"

Using powershell, read the arguments from a text file.

Get-Content args.txt | ForEach-Object {
    $arguments = $_ -split '#'
    & dissector.exe $arguments
}

Here is a sample args.txt file.

.\temp#*.csv#-s#,

Morpher

Using the morpher command-line tool

morpher.exe is a command-line tool to convert format of a file or files in a directory that have a common column separator. For example, convert file delimited by sep in dir from csv to xlsx or csv to json.

usage: morpher.exe [-h] [--sep SEP] [--replace] [--to {xlsx,json}] dir file

positional arguments:
  dir               Input directory
  file              Input file or files (wildcard)

optional arguments:
  -h, --help        show this help message and exit
  --sep SEP         Column separator (default: ,)
  --replace         Replace output file if it already exists (default: false)
  --to {xlsx,json}  Morph to xlsx or json (default: xlsx)

Comparator

Using the morpher command-line tool

comparator.exe is a command-line tool to compare one file with another file.

usage: comparator.exe [-h] [-s SEP] [-t {xlsx,json,csv}] file1 file2

positional arguments:
  file1                 File to compare
  file2                 File to compare with

optional arguments:
  -h, --help            show this help message and exit
  -s SEP, --sep SEP     Column separator (default: `,`)
  -t {xlsx,json,csv}, --to {xlsx,json,csv}
                        Save result to xlsx or json or csv (default: `xlsx`)

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

smart_tools-0.9.3.tar.gz (12.3 kB view details)

Uploaded Source

Built Distribution

smart_tools-0.9.3-py3-none-any.whl (14.9 kB view details)

Uploaded Python 3

File details

Details for the file smart_tools-0.9.3.tar.gz.

File metadata

  • Download URL: smart_tools-0.9.3.tar.gz
  • Upload date:
  • Size: 12.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.9

File hashes

Hashes for smart_tools-0.9.3.tar.gz
Algorithm Hash digest
SHA256 fc9c0113625e4a4b744d6a19c4712159f489c18a6342cc278d6b6fcca7218aaf
MD5 2ca1b64b03bd87fed2c0d17c79176bfd
BLAKE2b-256 cfd32356e5d6e688460103d174bfa379a902932339f82a6bbadbf315790fd373

See more details on using hashes here.

File details

Details for the file smart_tools-0.9.3-py3-none-any.whl.

File metadata

  • Download URL: smart_tools-0.9.3-py3-none-any.whl
  • Upload date:
  • Size: 14.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.9

File hashes

Hashes for smart_tools-0.9.3-py3-none-any.whl
Algorithm Hash digest
SHA256 240e417a7bb46059f9c16c7aac3b2d51194a2a1a2c36f1690b0f29a0817b5563
MD5 dda62493500b6203c56b1a9630cbcb0b
BLAKE2b-256 a0b5330f79f9b12116db733afd2194286260d6e1fb6b6c328b0b8ed09a35096e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page