Skip to content

Commit

Permalink
fix: make tangled-up-in-unicode an optional dependency (#1070)
Browse files Browse the repository at this point in the history
  • Loading branch information
akx authored and chanedwin committed Oct 30, 2022
1 parent f0e46de commit dfab121
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 8 deletions.
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,23 @@ Additional details, including information about widget support, are available [o
You can install using the `pip` package manager by running:

```sh
pip install -U pandas-profiling[notebook]
pip install -U pandas-profiling
```

#### Extras

The package declares "extras", sets of additional dependencies.

* `[notebook]`: support for rendering the report in Jupyter notebook widgets.
* `[unicode]`: support for more detailed Unicode analysis, at the expense of additional disk space.

Install these with e.g.

```sh
pip install -U pandas-profiling[notebook,unicode]
```


### Using conda
[![Conda Downloads](https://img.shields.io/conda/dn/conda-forge/pandas-profiling.svg)](https://anaconda.org/conda-forge/pandas-profiling)
[![Conda Version](https://img.shields.io/conda/vn/conda-forge/pandas-profiling.svg)](https://anaconda.org/conda-forge/pandas-profiling)
Expand Down
22 changes: 18 additions & 4 deletions docsrc/source/pages/getting_started/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ You can install using the ``pip`` package manager by running:

.. code-block:: console
pip install -U pandas-profiling[notebook]
jupyter nbextension enable --py widgetsnbextension
pip install -U pandas-profiling
If you are in a notebook (locally, LambdaLabs, Google Colab or Kaggle), you can run:

Expand Down Expand Up @@ -65,7 +64,8 @@ This can be done via ``pip``:

.. code-block::
pip install ipywidgets
pip install pandas-profiling[notebook]
jupyter nbextension enable --py widgetsnbextension
Or via ``conda``:

Expand All @@ -90,4 +90,18 @@ This can also be done via the following one-liner:

.. code-block:: console
pip install https://github.com/ydataai/pandas-profiling/archive/master.zip
pip install https://github.com/ydataai/pandas-profiling/archive/master.zip
Extras
------

The package declares some "extras", sets of additional dependencies.

* ``[notebook]``: support for rendering the report in Jupyter notebook widgets.
* ``[unicode]``: support for more detailed Unicode analysis, at the expense of additional disk space.

Install these with e.g.

.. code-block:: console
pip install -U pandas-profiling[notebook,unicode]
2 changes: 0 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ htmlmin==0.1.12
missingno>=0.4.2, <0.6
# Correlations
phik>=0.11.1,<0.13
# Text analysis
tangled-up-in-unicode==0.2.0
# Examples
requests>=2.24.0, <2.29
# Progress bar
Expand Down
3 changes: 3 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@
"jupyter-core>=4.6.3",
"ipywidgets>=7.5.1",
],
"unicode": [
"tangled-up-in-unicode==0.2.0",
],
},
package_data={
"pandas_profiling": ["py.typed"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,14 @@ def counter_to_series(counter: Counter) -> pd.Series:


def unicode_summary_vc(vc: pd.Series) -> dict:
from tangled_up_in_unicode import block, block_abbr, category, category_long, script
try:
from tangled_up_in_unicode import block, block_abbr, category, category_long, script
except ImportError:
from unicodedata import category
block = lambda char: "(unknown)"
block_abbr = lambda char: "(unknown)"
category_long = lambda char: "(unknown)"
script = lambda char: "(unknown)"

# Unicode Character Summaries (category and script name)
character_counts = get_character_counts_vc(vc)
Expand Down

0 comments on commit dfab121

Please sign in to comment.