A simple Python utility to describe the structure, type, and stats of a variable - for sharing with LLMs and other people.
Project description
vardescribe
A simple Python utility to describe the structure, types, and summary statistics of a variable. The generated report is printed to the console and automatically copied to your clipboard. Intended usage includes sharing the variable description with an LLM or another person for easy collaboration. The function does not use or access an LLM to generate the description.
Details
Printed descriptions includes:
- variable name
- shape
- dtype
- summary statistics
- column names of pandas dataframes
Clipboard Integration: Automatically copies the description to the clipboard for easy pasting into documents, notes, or chat applications (currently supports Windows).
Tested on:
- Windows, VSCode
- Simple variables, Pandas DataFrames, Numpy arrays
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
- Import vardescribe:
from vardescribe import vardescribe - Use it by passing a variable:
vardescribe(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
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file vardescribe-0.1.4.tar.gz.
File metadata
- Download URL: vardescribe-0.1.4.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ca3b720e4737320359dfff8772e2ed6d049c04d7c649f2f16982c31208fa5e80
|
|
| MD5 |
21a5b4da11b04aed3de5dc2a4235c54b
|
|
| BLAKE2b-256 |
1330d413563f3bd0e5b36037c3c4d8b0319fbb75662aca07201cd979d8127329
|
File details
Details for the file vardescribe-0.1.4-py3-none-any.whl.
File metadata
- Download URL: vardescribe-0.1.4-py3-none-any.whl
- Upload date:
- Size: 6.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
87331eb332b1873abdbac7e6eec33376269371e161fa1635d8a3ea050262dd5d
|
|
| MD5 |
e27ec00fea18af4b6afe85ca6122ab33
|
|
| BLAKE2b-256 |
cc17b9ac228a60ba4ec8d81669897e9cd77a859aac486f3676886debff8d5406
|