Skip to content

Issue visualizing pattern_tree #222

Description

@cegme

I tried to run the pattern tree example but I am getting the error below.

Setup: MacBook Pro Apple M2 Max
Pre setup: brew install pyenv pipenv

git clone ...
git branch pattern_tree

Note: I had to change the default port to 5001 because an apple display using 5000.

pipenv run python3 run.py

Data folder: OK_President2_TwoParty
chose on df.csv
Rank by Percentage

var_type: all categorical except for Votes2016 and Votes2020

role:
District2010Cycle=splitby
District2020Cycle=splitby
Party=independent
Votes2016=dependent
Votes2016=dependent

Clicked [Interactive Exploration]

Error

Traceback (most recent call last):
  File "/Users/christan/.local/share/virtualenvs/wiggum-U2i8wUjT/lib/python3.8/site-packages/flask/app.py", line 1478, in __call__
    return self.wsgi_app(environ, start_response)
  File "/Users/christan/.local/share/virtualenvs/wiggum-U2i8wUjT/lib/python3.8/site-packages/flask/app.py", line 1458, in wsgi_app
    response = self.handle_exception(e)
  File "/Users/christan/.local/share/virtualenvs/wiggum-U2i8wUjT/lib/python3.8/site-packages/flask/app.py", line 1455, in wsgi_app
    response = self.full_dispatch_request()
  File "/Users/christan/.local/share/virtualenvs/wiggum-U2i8wUjT/lib/python3.8/site-packages/flask/app.py", line 869, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/Users/christan/.local/share/virtualenvs/wiggum-U2i8wUjT/lib/python3.8/site-packages/flask/app.py", line 867, in full_dispatch_request
    rv = self.dispatch_request()
  File "/Users/christan/.local/share/virtualenvs/wiggum-U2i8wUjT/lib/python3.8/site-packages/flask/app.py", line 852, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
  File "/Users/christan/projects/wiggum/wiggum_app/controller.py", line 42, in explore
    labeled_df_setup.get_subgroup_trends_1lev(trend_list)
  File "/Users/christan/projects/wiggum/wiggum/detectors.py", line 273, in get_subgroup_trends_1lev
    agg_trends = cur_trend.get_trends(self.df,'agg_trend')
  File "/Users/christan/projects/wiggum/wiggum/trend_components/categorical.py", line 555, in get_trends
    stat_df = stat_df.assign(stat=stat_df.div(stat_df.sum()).round(3))
  File "/Users/christan/.local/share/virtualenvs/wiggum-U2i8wUjT/lib/python3.8/site-packages/pandas/core/frame.py", line 4844, in assign
    data[k] = com.apply_if_callable(v, data)
  File "/Users/christan/.local/share/virtualenvs/wiggum-U2i8wUjT/lib/python3.8/site-packages/pandas/core/frame.py", line 3940, in __setitem__
    self._set_item_frame_value(key, value)
  File "/Users/christan/.local/share/virtualenvs/wiggum-U2i8wUjT/lib/python3.8/site-packages/pandas/core/frame.py", line 4069, in _set_item_frame_value
    raise ValueError("Columns must be same length as key")
ValueError: Columns must be same length as key

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions