Usage#
This section demonstrates the most basic usage via import ipypandas
.
Imports#
The execution of import ipypandas
enables ipypandas globally.
[1]:
import numpy as np
import pandas as pd
[2]:
# enables ipypandas output
import ipypandas
Options#
Pandas options that will affect the ipypandas rendering.
[3]:
# The numbers of rows to show in a truncated view (when max_rows is exceeded).
# Ignored when max_rows is set to None or 0. When set to None, follows the value of max_rows.
pd.set_option('display.min_rows', 10) # [default: 10]
[4]:
# If max_rows is exceeded, switch to truncate view.
# Depending on large_repr, objects are either centrally truncated or printed as a summary view.
pd.set_option('display.max_rows', 60) # [default: 60]
[5]:
# The maximum width in characters of a column in the repr of a pandas data structure.
# When the column overflows, a “…” placeholder is embedded in the output.
pd.set_option('display.max_colwidth', 50) # [default: 50]
[6]:
# Floating point output precision in terms of number of places after the decimal.
# For regular formatting as well as scientific notation.
pd.set_option('display.precision', 6) # [default: 6]
Demos#
Example data used for demo purposes.
[7]:
df = pd.DataFrame(np.random.randint(1000, 9999, (1000, 5)), columns=['A', 'B', 'C', 'D', 'E'])
Running ipypandas.enable()
will enable all interactive features.
[8]:
ipypandas.enable()
# interactive ipypandas rendering
df
Running ipypandas.disable()
will disable all interactive features.
[9]:
ipypandas.disable()
# default pandas rendering
df
[9]:
A | B | C | D | E | |
---|---|---|---|---|---|
0 | 1392 | 6625 | 6315 | 3493 | 8985 |
1 | 9009 | 5472 | 8538 | 1152 | 2791 |
2 | 2197 | 6414 | 9545 | 7302 | 1726 |
3 | 6017 | 5987 | 1211 | 9825 | 5930 |
4 | 1141 | 2724 | 9873 | 5356 | 6862 |
... | ... | ... | ... | ... | ... |
995 | 6504 | 4735 | 2473 | 1037 | 1017 |
996 | 2196 | 1320 | 7094 | 5414 | 1170 |
997 | 9552 | 7153 | 9599 | 8186 | 7339 |
998 | 9321 | 7489 | 6474 | 8309 | 5058 |
999 | 6981 | 8784 | 2888 | 7654 | 7556 |
1000 rows × 5 columns