https://github.com/scwilkinson/pd-replicator
Copy a pandas DataFrame to the clipboard with one click
https://github.com/scwilkinson/pd-replicator
jupyter jupyterlab pandas
Last synced: 3 days ago
JSON representation
Copy a pandas DataFrame to the clipboard with one click
- Host: GitHub
- URL: https://github.com/scwilkinson/pd-replicator
- Owner: scwilkinson
- License: gpl-3.0
- Created: 2020-04-11T22:09:10.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2020-04-16T17:10:37.000Z (about 5 years ago)
- Last Synced: 2025-05-07T04:35:53.533Z (11 days ago)
- Topics: jupyter, jupyterlab, pandas
- Language: Python
- Homepage:
- Size: 258 KB
- Stars: 11
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-jupyter - pd-replicator - Copy a pandas DataFrame to the clipboard with one click. (Visualization)
README
# pd-replicator
[](https://pypi.org/project/pd-replicator/)
[](https://github.com/markusschanta/awesome-jupyter#readme)Copy a pandas DataFrame to the clipboard with one click

## Installation
Installation can be done through `pip`:
```sh
> pip install pd-replicator
````ipywidgets` must be setup in order for the button/dropdown to display correctly:
```sh
> pip install ipywidgets
> jupyter nbextension enable --py widgetsnbextension
```To use with JupyterLab, an additional step is required:
```sh
> jupyter labextension install @jupyter-widgets/jupyterlab-manager
```## Usage
`pd-replicator` can be used in classic Jupyter, JupyterLab, and Google Colaboratory.
It can be used on both local and remotely hosted instances (such as AWS SageMaker or JupyterHub).
### Enabling the Copy Button
Wrap `replicator()` around any `pandas` DataFrame/Series to display the replicator copy button above the DataFrame/Series:
```python
from pd_replicator import replicatorreplicator(df)
```For remotely hosted instances, the `native` option should be set to `False`:
```python
from pd_replicator import replicatorreplicator(df, native=False)
```This uses JavaScript to copy to the clipboard through your browser, rather than the system copy method used by `pandas.to_clipboard()`.
### Using the Copy Button
Clicking the "Copy" button will copy the associated DataFrame/Series to your clipboard in tab-seperated form. This means the DataFrame/Series can be pasted directly into Excel or Google Sheets without needing to split the text.
For example, selecting a single cell and pasting will result in something like this:

### Using the Dropdown
The dropdown allows some control over what is copied to your clipboard when you press the "Copy" button.

You can choose to exclude the index, header, or both from being copied.