show_in_browser
A simple python package to display pandas dataframes and matplotlib/plotly graphs in a browser. This package is intended to be used from the command line, for better visualisation of dataframes than viewing within the terminal. (E.g. to allow viewing of the entire dataframe, scrolling etc). In addition, plots appear sequentially as separate browser tabs, so they can be viewed in a deliberate sequence.
To install use: pip install show-in-browser
The following code shows some example uses (in an ipython session):
# import the show_in_browser functions as on the line below:
# (alternatively you can use `import show_in_browser as sib` and then access the functions
# with `sib.show_df()` etc.)
from show_in_browser import show_df, show_plt_plot, show_px_plot
# other imports for the demo script
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import plotly.express as px
# ==============================================================================
# SHOW DATAFRAMES IN THE BROWSER
# this section shows how to use the `show_df()` function to display a dataframe
# in the browser
# create dataframe
df = pd.DataFrame({'score_1': np.random.normal(100, 10, 100),
'score_2': np.random.normal(1000, 2, 100),
'score_3': np.random.normal(10, 2, 100)})
# show a DataFrame in a browser
show_df(df, name='Complete DataFrame') # name is optional
# show a Series derived from the DataFrame in a browser
show_df(df['score_1'], name='A Single Column') # name is optional
# ==============================================================================
# SHOW MATPLOTLIB PLOTS IN THE BROWSER
# this section shows how to use the `show_plt_plot()` function to display a
# matplotlib plots in the browser
# 2D matplotlib plot
plt.figure()
plt.scatter(df['score_1'], df['score_2'])
show_plt_plot(name='Matplotlib Scatterplot') # name is optional
# 3D matplotlib plot
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.scatter(df['score_1'], df['score_2'], df['score_3'])
show_plt_plot(name='Matplotlib 3D Scatterplot') # name is optional
# ==============================================================================
# SHOW PLOTLY PLOTS IN THE BROWSER
# this section shows how to use the `show_px_plot()` function to display a
# matplotlib plots in the browser
# 2D plotly plot
fig = px.scatter(df, x='score_1', y='score_2')
show_px_plot(fig, name='Plotly Scatterplot') # name is optional
# 3D plotly plot
fig = px.scatter_3d(df, x='score_1', y='score_2', z='score_3')
show_px_plot(fig, name='Plotly 3D Scatterplot') # name is optional
This code will give you output of the following form, in your default browser. Each dataframe or plot that you have selected will show in separate tabs in your default browser. The dataframes and plots will appear in the order in which you ran the commands:
Metadata
Release files for show-in-browser 0.1.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| show_in_browser-0.1.6.tar.gz | 6.8 kB | Without provenance | Details for show_in_browser-0.1.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| show_in_browser-0.1.6-py3-none-any.whl | Python 3 | none | any | Details for show_in_browser-0.1.6-py3-none-any.whl |
Total release size: 13.2 kB
Release files / show_in_browser-0.1.6.tar.gz
| Download URL | show_in_browser-0.1.6.tar.gz |
|---|---|
| Size | 6.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8cfb25233d97401a046e05487f4ed765ba953d69610704bdf8b8beef95d76eed
|
|
BLAKE2b-256 checksum How to use checksums |
3e3f7ea5ebcf311d6afce5d1a184bdf1835abecce92a1dc5d27e5ad8d756d684
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.3
|
Release files / show_in_browser-0.1.6-py3-none-any.whl
| Download URL | show_in_browser-0.1.6-py3-none-any.whl |
|---|---|
| Size | 6.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2dab9a15b04bc8390da5dfb29a2beef0a666c105a2573533d417dc0c70f39364
|
|
BLAKE2b-256 checksum How to use checksums |
64b545e433bab5386dce422414e0eb9c0eb17810050b15d01a4b8322415c6fe9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.3
|
Security for show-in-browser 0.1.6
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.