Skip to main content

Various little hacks.

Project description

LigonLibrary

A Python utility library for working with DataFrames, Google Sheets, fuzzy string matching, and more.

Installation

Install directly from GitHub:

pip install git+https://github.com/ligon/LigonLibrary.git

Or add to your project's dependencies (e.g. in pyproject.toml):

dependencies = [
    "ligonlibrary @ git+https://github.com/ligon/LigonLibrary.git",
]

Requires Python 3.11+.

What's included

DataFrame utilities

  • get_dataframe(f) — Read a DataFrame from nearly any file: CSV, Excel, Parquet, Feather, Stata (.dta), SPSS, fixed-width, org-tables, and GPG-encrypted variants of all of the above.
  • df_to_orgtbl(df) — Render a DataFrame as an Emacs org-mode table, with optional standard errors, confidence intervals, and significance stars.
  • orgtbl_to_df(table) — Parse an org-mode table back into a DataFrame.
  • df_from_orgfile(path) — Read named tables from .org files.
  • from_dta(fn) — Read Stata .dta files with automatic label decoding.
  • normalize_strings(df, ...) — Normalize string columns in a DataFrame.
  • find_similar_pairs(s1, s2) — Find fuzzy-matching pairs between two Series.

Google Sheets

  • read_sheets(key, ...) / read_public_sheet(key) — Read a Google Sheet into a DataFrame.
  • write_sheet(df, key, ...) — Write a DataFrame to a Google Sheet.
  • delete_sheet(key) — Delete a Google Sheet.
  • get_credentials(...) — Load Google service-account credentials (supports GPG-encrypted JSON).

String matching

  • normalized(s) — Normalize a string (case, whitespace, hyphens).
  • similar(a, b) — Check whether two strings are fuzzy-similar.
  • most_similar(s, candidates) — Find the best fuzzy match from a list.

Other

  • email_from_ligon(...) — Send email via the Gmail API.
  • get_password_for_machine(host) — Look up a password in a GPG-encrypted ~/.authinfo.gpg file.

License

BSD 3-Clause. See LICENSE.

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

ligonlibrary-0.2.0.tar.gz (17.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ligonlibrary-0.2.0-py3-none-any.whl (19.4 kB view details)

Uploaded Python 3

File details

Details for the file ligonlibrary-0.2.0.tar.gz.

File metadata

  • Download URL: ligonlibrary-0.2.0.tar.gz
  • Upload date:
  • Size: 17.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.12.12 Linux/6.6.99-09000-gd3ae1caecf39

File hashes

Hashes for ligonlibrary-0.2.0.tar.gz
Algorithm Hash digest
SHA256 b120b336791d767090661934f44a377492df93c8f596e41ee977a16e110397e7
MD5 a45c4a6295b45a0fd595bb3ade6de144
BLAKE2b-256 c01553884e13d1805ba2ed5101fc3e106b3192e375fe967fe4c89f125c6ce8ca

See more details on using hashes here.

File details

Details for the file ligonlibrary-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: ligonlibrary-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 19.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.12.12 Linux/6.6.99-09000-gd3ae1caecf39

File hashes

Hashes for ligonlibrary-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a7a4a28cb21e92b58d3a7f5e505e6cf534820c973a4eaaa5a146486f0265461c
MD5 4485e510ae24621829c1e947c0ab3ab3
BLAKE2b-256 19d82fd475d64260e57ed6500e6a76d44d95bbbaa2a233259184a8176045c639

See more details on using hashes here.

Supported by

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