Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add jinja2 requirement #488

Open
BieniekAlexander opened this issue Apr 10, 2022 · 0 comments
Open

Add jinja2 requirement #488

BieniekAlexander opened this issue Apr 10, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@BieniekAlexander
Copy link

Your bug may already be reported!
Please search on the issue tracker before creating one.

Description
data_describe summary method requires jinja when using pandas dataframe style method. WIthout the jinja2 dependency, the summary table may render with a lot of information missing.

Stacktrace:

File ~/Software/anaconda3/envs/model-promotion/lib/python3.9/site-packages/data_describe/core/summary.py:104, in SummaryWidget.show(self, viz_backend, as_percentage, auto_float, **kwargs)
    101             format_dict[col] = _value_formatter
    103 if len(format_dict) > 0:
--> 104     view(summary_data.style.format(format_dict))
    105 else:
    106     view(summary_data)

File ~/Software/anaconda3/envs/model-promotion/lib/python3.9/site-packages/pandas/core/frame.py:1212, in DataFrame.style(self)
   1200 https://github.com/Property
   1201 def style(self) -> Styler:
   1202     """
   1203     Returns a Styler object.
   1204 
   (...)
   1210         data with HTML and CSS.
   1211     """
-> 1212     from pandas.io.formats.style import Styler
   1214     return Styler(self)

File ~/Software/anaconda3/envs/model-promotion/lib/python3.9/site-packages/pandas/io/formats/style.py:52, in <module>
     48 from pandas.core.shared_docs import _shared_docs
     50 from pandas.io.formats.format import save_to_buffer
---> 52 jinja2 = import_optional_dependency("jinja2", extra="DataFrame.style requires jinja2.")
     54 from pandas.io.formats.style_render import (
     55     CSSProperties,
     56     CSSStyles,
   (...)
     64     refactor_levels,
     65 )
     67 try:

File ~/Software/anaconda3/envs/model-promotion/lib/python3.9/site-packages/pandas/compat/_optional.py:141, in import_optional_dependency(name, extra, errors, min_version)
    139 except ImportError:
    140     if errors == "raise":
--> 141         raise ImportError(msg)
    142     else:
    143         return None

ImportError: Missing optional dependency 'Jinja2'. DataFrame.style requires jinja2. Use pip or conda to install Jinja2.

Steps to Reproduce

  1. uninstall jinja2 from python environment
  2. install data_describe
  3. call data_summary method on pandas dataframe, in data_describe/core/summary.py (I'm not sure what the dataframe should have, exactly, to produce the issue)
import data_describe as dd
import pandas as pd

path_to_data = "TODO"
data = pd.read_csv(path_to_data)
dd.data_summary(data)

Possible Solution
in requirements.txt:

jinja>=3.1.1

Your Environment

  • data describe version: 0.1.0b3
  • Python version: 3.9.12
  • Operating System: Ubuntu 18.04.6 LTS
@BieniekAlexander BieniekAlexander added the bug Something isn't working label Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant