Skip to main content

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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

pyside6pandas-0.0.1-cp312-cp312-manylinux_2_39_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.39+ x86-64

File details

Details for the file pyside6pandas-0.0.1-cp312-cp312-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for pyside6pandas-0.0.1-cp312-cp312-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 60dac7c7d333081be5686ad0c2237691633c51b0bc5a81a8ac34c60369803b47
MD5 3ae9c03b20417a398ee6e05d0d82d737
BLAKE2b-256 59ab1ce9b86c6059602de43a269e8c08d9009356b1b2910207a3e20efc07e550

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.0.1 This release

1 file

0.0.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page