DataFrame generation, CSV/HTML/chart export, and template rendering for numpy arrays and FieldSet containers
Project description
FieldSet Export
DataFrame generation, CSV/HTML/chart export, and template rendering for numpy arrays and FieldSet containers.
pandas is optional — CSV, table, and chart exporters work with just numpy. Only StyledExporter requires pandas.
Installation
pip install vcti-fieldset-export>=1.0.0
With pandas support (for StyledExporter):
pip install vcti-fieldset-export[pandas]>=1.0.0
With all optional dependencies:
pip install vcti-fieldset-export[all]>=1.0.0
Quick Start
All exporters accept numpy arrays, dicts of numpy arrays, or pandas DataFrames.
CSV Export
import numpy as np
from vcti.fieldsetexport import CsvExporter
# From a dict of numpy arrays (no pandas needed)
CsvExporter({"stress": np.array([100, 200]), "disp": np.array([0.1, 0.2])}).export("output.csv")
# From a 2-D numpy array with field names
CsvExporter(np.array([[100, 0.1], [200, 0.2]]), field_names=["stress", "disp"]).export("output.csv")
# From a pandas DataFrame (requires pandas)
import pandas as pd
CsvExporter(pd.DataFrame({"stress": [100, 200], "disp": [0.1, 0.2]})).export("output.csv")
HTML Table (Tabulator)
from vcti.fieldsetexport import TableExporter
TableExporter({"stress": np.array([100, 200])}).export("output.html")
Styled HTML (requires pandas)
from vcti.fieldsetexport import StyledExporter
(
StyledExporter({"stress": np.array([100, 200])})
.set_caption("Results")
.set_format(precision=2)
.export_html("styled.html")
)
Interactive Chart
from vcti.fieldsetexport import ChartExporter, Trace, FigType, Fig
exporter = ChartExporter({"x": np.array([1, 2, 3])})
exporter.plot.title = "Stress vs Displacement"
exporter.plot.x_axis_title = "Index"
exporter.plot.y_axis_title = "Value"
fig = Fig(FigType.XY)
fig.add_trace(Trace("Stress", np.array([100, 200, 300]), color="blue"))
fig.add_trace(Trace("Displacement", np.array([0.1, 0.2, 0.3]), color="red"))
exporter.add_fig(fig)
exporter.export("chart.html")
Export Result and Dry-Run Validation
Every export() call returns an ExportResult with statistics:
result = CsvExporter({"stress": np.array([100, 200])}).export("output.csv")
print(result) # ExportResult: 2 rows × 1 cols in 1.2ms, 34 bytes
# Dry-run: validate data + template without writing a file
result = CsvExporter(data).export("output.csv", validate_only=True)
assert result.dry_run is True
Error Handling
All export errors inherit from ExportError for easy catch-all handling:
from vcti.fieldsetexport import CsvExporter, ExportError, InvalidDataError
try:
CsvExporter(data).export("output.csv")
except InvalidDataError as e:
print(f"Bad data: {e}") # empty array, wrong shape, etc.
except ExportError as e:
print(f"Export failed: {e}") # catches any export error
Exception hierarchy: ExportError > InvalidDataError, TemplateRenderError, FileWriteError.
Dependencies
- numpy (>=1.24) — required
- jinja2 (>=3.0) — required
- pandas (>=2.0) — optional (for StyledExporter)
- vcti-fieldset — optional (for FieldSet integration)
- beautifulsoup4 — optional (for styled HTML export)
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 vcti_fieldset_export-1.0.0.tar.gz.
File metadata
- Download URL: vcti_fieldset_export-1.0.0.tar.gz
- Upload date:
- Size: 24.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
477e0dab4ff327728871740d2281c9d6c1642c6730b50656dfe1e830266bd3da
|
|
| MD5 |
9a680fe76544e82860f0320bac5e45a3
|
|
| BLAKE2b-256 |
a9c0f521027f061d164f418df3398bfc84609afafe78e5fd3dfbf718f1d2db04
|
Provenance
The following attestation bundles were made for vcti_fieldset_export-1.0.0.tar.gz:
Publisher:
publish.yml on vcollab/vcti-python-fieldset-export
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vcti_fieldset_export-1.0.0.tar.gz -
Subject digest:
477e0dab4ff327728871740d2281c9d6c1642c6730b50656dfe1e830266bd3da - Sigstore transparency entry: 1192938239
- Sigstore integration time:
-
Permalink:
vcollab/vcti-python-fieldset-export@fc3b9a4bbf6b9f1f592a410b4b56d9f5ff07df61 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/vcollab
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@fc3b9a4bbf6b9f1f592a410b4b56d9f5ff07df61 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file vcti_fieldset_export-1.0.0-py3-none-any.whl.
File metadata
- Download URL: vcti_fieldset_export-1.0.0-py3-none-any.whl
- Upload date:
- Size: 27.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d53ec033a452608471c02584aade3fea9340f73de382f6e6e3b67c8e69dfd21c
|
|
| MD5 |
4e452c6eaa865bd98506d4c627bd99f3
|
|
| BLAKE2b-256 |
0fa40872fd2d2cbfb18146ac1afd8fe62e9f6ca41882c21959e97ee684fe7da3
|
Provenance
The following attestation bundles were made for vcti_fieldset_export-1.0.0-py3-none-any.whl:
Publisher:
publish.yml on vcollab/vcti-python-fieldset-export
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vcti_fieldset_export-1.0.0-py3-none-any.whl -
Subject digest:
d53ec033a452608471c02584aade3fea9340f73de382f6e6e3b67c8e69dfd21c - Sigstore transparency entry: 1192938294
- Sigstore integration time:
-
Permalink:
vcollab/vcti-python-fieldset-export@fc3b9a4bbf6b9f1f592a410b4b56d9f5ff07df61 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/vcollab
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@fc3b9a4bbf6b9f1f592a410b4b56d9f5ff07df61 -
Trigger Event:
workflow_dispatch
-
Statement type: