Ahmed Khalifa
Ahmed Khalifa

Reputation: 11

I have python error when import sensitivity

In Python when write #

import sensitivity

i found that error


ImportError Traceback (most recent call last) in ----> 1 import sensitivity

~\anaconda3\envs\name_of_my_env\lib\site-packages\sensitivity_init_.py in 3 visualizations including gradient DataFrames and hex-bin plots 4 """ ----> 5 from sensitivity.main import SensitivityAnalyzer

~\anaconda3\envs\name_of_my_env\lib\site-packages\sensitivity\main.py in 9 from IPython.display import display, HTML 10 ---> 11 from sensitivity.df import sensitivity_df, _style_sensitivity_df, _two_variable_sensitivity_display_df 12 from sensitivity.hexbin import _hex_figure_from_sensitivity_df 13

~\anaconda3\envs\name_of_my_env\lib\site-packages\sensitivity\df.py in 6 7 import pandas as pd ----> 8 import pd_utils 9 from pandas.io.formats.style import Styler 10 import numpy as np

~\anaconda3\envs\name_of_my_env\lib\site-packages\pd_utils_init_.py in 37 join_col_strings 38 ) ---> 39 from pd_utils.plot import plot_multi_axis 40 41

~\anaconda3\envs\name_of_my_env\lib\site-packages\pd_utils\plot.py in 2 3 import pandas as pd ----> 4 from pandas.plotting._matplotlib.style import _get_standard_colors 5 import matplotlib.pyplot as plt 6

ImportError: cannot import name '_get_standard_colors' from 'pandas.plotting._matplotlib.style' (C:\Users\DELL\anaconda3\envs\name_of_my_env\lib\site-packages\pandas\plotting_matplotlib\style.py)

Upvotes: 1

Views: 433

Answers (2)

Nick DeRobertis
Nick DeRobertis

Reputation: 31

I'm the creator of sensitivity and I just put a fix for this (see GitHub issue).

pip install --upgrade sensitivity should should get you v0.2.6 or newer and fix the issue (see releases).

It was caused by newer versions of Pandas that moved things around and broke another one of my packages, pd_utils, which this depended on. It turned out the functionality I needed from pd_utils was very small and unrelated to the part that was breaking, so I refactored things a bit to remove pd_utils as a dependency (this should keep it more stable going forward as well).

Upvotes: 0

bromate
bromate

Reputation: 91

There is a mistake on the plot.py script of the sensitivity library. You need to change the import from from pandas.plotting._matplotlib.style import _get_standard_colors to from pandas.plotting._matplotlib.style import get_standard_colors

Therefore just removing the underscore

Upvotes: 1

Related Questions