Process, transform and analyze survey-format data with clean and simple API.
Project description
survy
Process, transform, and analyze survey-format data with a clean and simple API.
📦 Overview
survy is a lightweight Python library built for working efficiently with survey data.
It simplifies the full workflow—from raw data ingestion to transformation and analysis—while preserving survey-specific structures like multiselect questions.
✨ Features
- 🔹 Multiselect as a first-class concept
- 🔹 Read & write multiple formats: CSV, Excel, JSON, SPSS, etc.
- 🔹 Clean, minimal, and expressive API
- 🔹 Built-in tools for validation, tracking, and analysis
🚀 Installation
pip install survy
⚡ Quick Demo
Sample data
data.csv
id,Q1,Q2_1,Q2_2,Q2_3
1,a,a,b,
2,b,a,,c
3,a,,b,c
data_compact.csv
id,Q1,Q2
1,a,a;b
2,b,a
3,a,b;c
Load and analyze
import survy
# Load dataset with compact multiselect column
survey = survy.read_csv("data.csv")
#or
survey = survy.read_csv(
"data_compact.csv",
compact_ids=["Q2"],
compact_separator=";"
)
# Inspect variable
q1 = survey["Q1"]
print(q1.frequencies)
# Crosstab analysis
crosstab = survy.crosstab(survey["Q1"], survey["Q2"])
print(crosstab)
📥 Usage
Load data
survey = survy.read_csv("data.csv")
With compact multiselect:
survey = survy.read_csv(
"data.csv",
compact_ids=["Q2"],
compact_separator=";"
)
Get DataFrame
survey.get_df(select_dtype="text", multiselect_dtype="compact")
Work with variables
q1 = survey["Q1"]
print(q1.vtype)
print(q1.value_indices)
print(q1.base)
print(q1.frequencies)
Update variables
q1.label = "Question 1"
q1.value_indices = {"b": 1, "a": 2}
Batch update:
survey.update([
{
"id": "Q1",
"label": "Question 1",
"value_indices": {"b": 1, "a": 2}
}
])
Export
survey.to_csv(name="output")
survey.to_spss(name="output")
Analyze
crosstab = survy.crosstab(survey["Q1"], survey["Q2"])
print(crosstab)
🧠 Design Philosophy
- Keep survey logic explicit (variables, labels, value mappings)
- Treat multiselect questions as a core data type
- Provide a clean abstraction over high-performance data processing
🤝 Contributing
Contributions are welcome! Feel free to open issues or submit pull requests.
📄 License
MIT License
🔗 References
- Powered by Polars for fast data processing
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 survy-0.1.3.tar.gz.
File metadata
- Download URL: survy-0.1.3.tar.gz
- Upload date:
- Size: 21.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a870b234bdefd9903bc854b3ee9d7c26398f66d83db29435dde87ab19caed67e
|
|
| MD5 |
f5cecd3d6ddf5c4c2dbf1f0ab3c7dff7
|
|
| BLAKE2b-256 |
291cd1bf0ecefe80f24e62e196553455f5c6c288cd653f241d3bf98c62d75f0e
|
File details
Details for the file survy-0.1.3-py3-none-any.whl.
File metadata
- Download URL: survy-0.1.3-py3-none-any.whl
- Upload date:
- Size: 28.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1ece5f7e2f78dc122bdf222a7bd3e82b3817a36fe63140f0a141cd8b8ebd58d0
|
|
| MD5 |
2d54811fb526eefb02e07b7975bcbc91
|
|
| BLAKE2b-256 |
4118c2c7edd2eefb63e07dd8105384062d1139be580f4b8d727d2920de460c71
|