PySide6Pandas
PySide6Pandas is a Python module that contains classes for extending Pandas to integrate with PySide6, based off of PyQt5Pandas. It provides utilities to use Pandas DataFrames in PySide6 applications, including custom table models for displaying and editing data in QTableView, as well as dialogs for importing data from CSV files and other formats.
## Features
- **Pandas DataFrame Integration**: Custom QAbstractTableModel implementations for seamless display of Pandas DataFrames in PySide6's QTableView.
- **Editable Views**: Support for editing DataFrame cells directly in the GUI, with changes reflected back to the underlying DataFrame.
- **Data Import Dialogs**: Dialogs like CSVImportDialog for loading data into DataFrames from files.
- **Sorting and Filtering**: Built-in support for sorting columns and filtering rows within the view.
- **Extensible Classes**: Easily subclass models and views for custom behaviors.
- **Cross-Platform Compatibility**: Works on Windows, macOS, and Linux with PySide6.
- **Performance Optimized**: Efficient handling of large DataFrames with lazy loading and virtualization.
## Installation
You can install PySide6Pandas via pip:
```bash
pip install pyside6pandas
```
Alternatively, clone the repository and install from source:
```bash
git clone https://github.com/<USER_OR_ORG>/pyside6pandas.git
cd pyside6pandas
pip install -e .
```
### Requirements
- Python 3.<MIN_VERSION> or higher
- Dependencies: pyside6, pandas (automatically installed via pip where applicable)
## Quick Start
Import the module, create a DataFrameModel, and display it in a QTableView:
```python
import sys
from PySide6.QtWidgets import QApplication, QTableView
import pandas as pd
from pyside6pandas.models import DataFrameModel
app = QApplication(sys.argv)
df = pd.DataFrame({'Name': ['Alice', 'Bob'], 'Age': [30, 25]})
model = DataFrameModel(df)
view = QTableView()
view.setModel(model)
view.show()
sys.exit(app.exec())
```
## Usage
### Creating a DataFrameModel
The core class is DataFrameModel, which extends QAbstractTableModel:
```python
from pyside6pandas.models import DataFrameModel
df = pd.DataFrame(data=[[1, 2], [3, 4]], columns=['Col1', 'Col2'])
model = DataFrameModel(df, editable=True)
# Use model with QTableView
```
### Using Data Import Dialogs
Import data via dialogs:
```python
from pyside6pandas.views import CSVImportDialog
dialog = CSVImportDialog()
if dialog.exec():
df = dialog.getDataFrame()
# Use the imported DataFrame
```
### Advanced Views
Extend or use provided views for additional functionality:
```python
from pyside6pandas.views import DataFrameView
view = DataFrameView()
view.setDataFrame(df)
view.show()
```
## Examples
### Example 1: Basic DataFrame Display
```python
import sys
from PySide6.QtWidgets import QApplication, QMainWindow
import pandas as pd
from pyside6pandas.models import DataFrameModel
from pyside6pandas.views import DataFrameView
app = QApplication(sys.argv)
window = QMainWindow()
df = pd.read_csv('data.csv')
view = DataFrameView()
view.setDataFrame(df)
window.setCentralWidget(view)
window.show()
sys.exit(app.exec())
```
### Example 2: Editable DataFrame with Saving
```python
import sys
from PySide6.QtWidgets import QApplication, QTableView, QPushButton, QVBoxLayout, QWidget
import pandas as pd
from pyside6pandas.models import DataFrameModel
app = QApplication(sys.argv)
df = pd.DataFrame({'Item': ['A', 'B'], 'Price': [10.5, 20.0]})
model = DataFrameModel(df, editable=True)
view = QTableView()
view.setModel(model)
save_button = QPushButton('Save Changes')
save_button.clicked.connect(lambda: df.to_csv('updated.csv'))
layout = QVBoxLayout()
layout.addWidget(view)
layout.addWidget(save_button)
widget = QWidget()
widget.setLayout(layout)
widget.show()
sys.exit(app.exec())
```
## Configuration Guide
Customize models with options like:
- `editable`: Boolean to enable editing (default: False)
- `sortable`: Boolean to enable column sorting (default: True)
- `custom_formatters`: Dictionary for column-specific formatting
For advanced customization, refer to the [docs/config-reference.md](docs/config-reference.md).
## Contributing
Contributions are welcome! Please follow these steps:
1. Fork the repository.
2. Create a feature branch (`git checkout -b feature/<FEATURE_NAME>`).
3. Commit your changes (`git commit -am 'Add some feature'`).
4. Push to the branch (`git push origin feature/<FEATURE_NAME>`).
5. Open a Pull Request.
See [CONTRIBUTING.md](CONTRIBUTING.md) for more details.
## License
This project is licensed under the <LICENSE_TYPE> License - see the [LICENSE](LICENSE) file for details.
## Acknowledgments
- Based on the concepts from PyQt5Pandas for PyQt5 integration.
- Thanks to contributors of underlying libraries like PySide6, pandas.
Metadata
Release files for pyside6pandas 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyside6pandas-0.0.1-cp312-cp312-manylinux_2_39_x86_64.whl | CPython 3.12 | CPython 3.12 | Linux glibc 2.39+ x86-64 | Details for pyside6pandas-0.0.1-cp312-cp312-manylinux_2_39_x86_64.whl |
Release files / pyside6pandas-0.0.1-cp312-cp312-manylinux_2_39_x86_64.whl
| Download URL | pyside6pandas-0.0.1-cp312-cp312-manylinux_2_39_x86_64.whl |
|---|---|
| Size | 1.0 MB |
| Tags | CPython 3.12 Linux glibc 2.39+ x86-64 |
|
SHA-256 checksum How to use checksums |
60dac7c7d333081be5686ad0c2237691633c51b0bc5a81a8ac34c60369803b47
|
|
BLAKE2b-256 checksum How to use checksums |
59ab1ce9b86c6059602de43a269e8c08d9009356b1b2910207a3e20efc07e550
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Security for pyside6pandas 0.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.