Skip to main content

A simple Python utility to describe the structure, type, and stats of a variable - for sharing with LLMs and other people.

Project description

vardescribe

Do you find yourself describing a complex dict or dataframe to an LLM for context? vardescribe is a simple Python function that prints out the structure, types, and summary statistics of a variable. The output can be easily shared with an LLM or another person for a complete, descriptive overview of that variable.
Example outputs for dict and Pandas dataframe:

dict 'my_dict' with 3 keys
        'name'  str [length: 8]
        'age'   scalar int [value: 30]
        'is_student'    scalar bool [value: 0]
dataframe 'my_df' with 5 rows, 5 columns
        'student_id'    int64   [min:101, max:105, avg:103]
        'major'         object
        'gpa'           float64 [min:3.1, max:3.9, avg:3.5]
        'credits_earned'        int64   [min:55, max:110, avg:80]
        'is_scholarship'        bool

Details

Printed fields include:

  • variable name
  • shape
  • dtype
  • summary statistics
  • column names of pandas dataframes

Clipboard Integration (Windows only): automatically copies the description to the clipboard for easy pasting into documents, notes, or chat applications.

Currently tested on Windows, Ubuntu

Getting Started

Install

pip install vardescribe

Dependencies

Required

  • numpy pip install numpy

Optional

  • Pandas: Required for describing DataFrame objects. If Pandas is not installed, vardescribe will function correctly for all other types. pip install pandas

Usage

  1. Import: from vardescribe import vardescribe
  2. Function call: vardescribe(your_variable_name)

Example

import numpy as np
import pandas as pd
from vardescribe import vardescribe

my_scalar = 2
my_list = [1, 2, 3, 4, 5]
my_numpy_array = np.array([[1, 2], [3, 4]])
my_dict = {
    "name": "John Doe",
    "age": 30,
    "is_student": False
}
student_data = {
    'student_id': [101, 102, 103, 104, 105],
    'major': ['Computer Science', 'Biology', 'Business', 'Art History', 'Computer Science'],
    'gpa': [3.8, 3.2, 3.5, 3.9, 3.1],
    'credits_earned': [90, 65, 80, 110, 55],
    'is_scholarship': [True, False, True, True, False]
}
my_df = pd.DataFrame(student_data)

#describe variables
vardescribe(my_scalar)
print('\n')
vardescribe(my_list)
print('\n')
vardescribe(my_numpy_array)
print('\n')
vardescribe(my_dict)
print('\n')
vardescribe(my_df)

Example output

scalar 'my_scalar' int [value: 2]


list 'my_list' size(5) [all int]
        scalar int [value: 1]


ndarray 'my_numpy_array' size(2, 2) int64 [min:1, max:4, avg:2.5]


dict 'my_dict' with 3 keys
        'name'  str [length: 8]
        'age'   scalar int [value: 30]
        'is_student'    scalar bool [value: 0]


dataframe 'my_df' with 5 rows, 5 columns
        'student_id'    int64   [min:101, max:105, avg:103]
        'major'         object
        'gpa'           float64 [min:3.1, max:3.9, avg:3.5]
        'credits_earned'        int64   [min:55, max:110, avg:80]
        'is_scholarship'        bool```
        
## Author
Igor Reidler
igormail@gmail.com

## Version History
* 0.1
    * Initial Release

## License
This project is licensed under the [MIT] License - see the LICENSE.md file for details

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

vardescribe-0.1.5.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

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

vardescribe-0.1.5-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file vardescribe-0.1.5.tar.gz.

File metadata

  • Download URL: vardescribe-0.1.5.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.7

File hashes

Hashes for vardescribe-0.1.5.tar.gz
Algorithm Hash digest
SHA256 652afed8c492204a0f4140e66014075647ccb6d163cea2e2b7abeb34198c7d84
MD5 334ab99fd695fd62662285ed64d4ccb7
BLAKE2b-256 822897cc156ea19b332b1c9db6e8a02bddff7e8e54ceae4b402e50148f042422

See more details on using hashes here.

File details

Details for the file vardescribe-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: vardescribe-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.7

File hashes

Hashes for vardescribe-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 945e8d8be1841451a53f6ec77dda4d0e2603d49fda86418fbae78b91dfa5e29f
MD5 773ea2f2c3d87fb9cf621a0510ff4472
BLAKE2b-256 8157f76c054183d804cc64e7fc4faba2aa4a1253e662ba3cb4f4861719245b96

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