Skip to main content

dukit - data utilities kit

Provides utilities focused on data exploration, modification and visualization of small but messy datasets in pandas.

hosted on github as dukit
published on pypi as dukit


qlang

A small query language. It is implemented as a pandas accessor extension, meaning it can be called from a dataframe without any further preparation by calling df.dk.qs() with a valid text string.

example:

import dukit as dk

df = dk.get_df()

#show all patients with ID > 20000
df.dk.qs(r'id  >20000')

#select all patients whose name contains "john"
df.dk.qs(r'name  ?john')

#select all patients whose name contains "j" and "a"
df.dk.qs(r'name  ?j  &&?a')

#select all patients whose name contains "j" or "a"
df.dk.qs(r'name  ?j  //?a')

#select ages between 18 and 80 and highlight them green
df.dk.qs(r'age  >18  &&<80  .color(green)')

Take a look at "interactive_demo.ipynb" in the github repo for a quick syntax introduction and more examples.

The query language allows for arbitrary code execution via eval(), please be aware of the risks.

dk.diff()

Creates colored diff output between two datasets. See interactive_demo.ipynb for examples. Works with pandas dataframes, csv files, excel files and excel files with multiple sheets.

other utilities



dk.log()

A small logger to be used in notebooks or the REPL. Makes it easier to keep track of outputs in large notebooks by providing color coded output. Does not log to file, but instead to a dataframe which can then be viewed at the end of the notebook.

df reshaping

these functions offer various ways to deal with non-unique keys/ids.
primarily used when merging 2 dfs with a one-to-many relationship.

available functions:

  • df.dk.flatten()
  • df.dk.stagger()
  • df.dk.embed()
  • df.dk.collapse()


"bashlike" wrappers

While python has functions to achieve similar results as common bash commands, they are often more verbose, less intuitive if you are already used to the bash names and spread out over different modules and different namespaces in those modules (os, os.path, shutil, sys, ...).
These wrappers use the same names as the bash commands and offer some additional functionality.

available wrappers:

  • dk.ls()
  • dk.lsr()
  • dk.pwd()
  • dk.cd()
  • dk.cp()
  • dk.mv()
  • dk.mkdir()
  • dk.isdir()
  • dk.isfile()
  • dk.ispath()


type utilities

Mostly wrappers for pandas functions but with some additional functionality and generally more lenient handling of edge cases.

available functions/classes:

  • dk.type()
  • dk.convert()
  • dk.str()
  • dk.int()
  • dk.float()
  • dk.num()
  • dk.bool()
  • dk.date()
  • dk.datetime()
  • dk.na()
  • dk.nk()
  • dk.yn()
  • dk.list()
  • dk.Box


Metadata

Release files for dukit 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dukit 0.2.1
File Size Uploaded
dukit-0.2.1.tar.gz 43.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dukit 0.2.1
File Interpreter ABI Platform
dukit-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 92.0 kB

Release files / dukit-0.2.1.tar.gz

Download URL dukit-0.2.1.tar.gz
Size 43.9 kB
Tags Source
SHA-256 checksum
How to use checksums
f9939d3c1d4895e9196da2e819af2a6a7ed947d965ecaaf1e08f26b0eee22e6a
BLAKE2b-256 checksum
How to use checksums
aea37e2ac9af736d92735e0631f7f6c5ca522ba99a5c3a015c85e6e97d198131
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / dukit-0.2.1-py3-none-any.whl

Download URL dukit-0.2.1-py3-none-any.whl
Size 48.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8479dd421393bfb7d5c363b37f567a8787a0d647804aca154d795dcfc64212a7
BLAKE2b-256 checksum
How to use checksums
2b64d66454f60c8f731f115ae993327c615bd8edf2602d0da87998e25ed4e9a7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

This release

0.2.1 This release

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page