-
Notifications
You must be signed in to change notification settings - Fork 334
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
Support MultiIndex in the Web App #381
Comments
Hi, Thanks, Can you give us an example of a MultiIndex that does not work as you would like?
When i run the app, the app works and index is concatenated: What result do you expect ? |
Hi Thanks for the reply. Stacktrace: \filer16l\p-v160l\SIMBA.A11244\90_Persoenlich\u229351\Saisonalisierung_PG\02_Code\shapash-master\shapash\explainer\smart_explainer.py in run_app(self, port, host, title_story, settings) \filer16l\p-v160l\SIMBA.A11244\90_Persoenlich\u229351\Saisonalisierung_PG\02_Code\shapash-master\shapash\webapp\smart_app.py in init(self, explainer, settings) \filer16l\p-v160l\SIMBA.A11244\90_Persoenlich\u229351\Saisonalisierung_PG\02_Code\shapash-master\shapash\webapp\smart_app.py in init_data(self) ~\dg_env\lib\site-packages\pandas\core\frame.py in setitem(self, key, value) ~\dg_env\lib\site-packages\pandas\core\frame.py in _set_item(self, key, value) ~\dg_env\lib\site-packages\pandas\core\frame.py in _sanitize_column(self, value) ~\dg_env\lib\site-packages\pandas\core\construction.py in sanitize_array(data, index, dtype, copy, raise_cast_failure, allow_2d) ~\dg_env\lib\site-packages\pandas\core\construction.py in extract_array(obj, extract_numpy, extract_range) ~\dg_env\lib\site-packages\pandas\core\indexes\multi.py in array(self) ValueError: MultiIndex has no single backing array. Use 'MultiIndex.to_numpy()' to get a NumPy array of tuples. |
First of all, thank you for the great library! Investigating shap values with it is pretty comfortable.
Description of Problem:
The Shapax App does not support DataFrames with MultiIndexes. MultiIndexes are useful for querying tables coming from other structured data formats.
At the xpl.run_app() step an error occurs at https://github.com/MAIF/shapash/blob/master/shapash/webapp/smart_app.py#L149.
Overview of the Solution:
Use reset_index() instead of assigning the index to a column named index. If need be, store the names of the index columns for differentiating them from the remaining dataframe.
Examples:
Blockers:
Definition of Done:
The text was updated successfully, but these errors were encountered: