question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

BoxPlot - multiple issues

See original GitHub issue

Make sure these boxes are checked before submitting your issue - thank you!

  • I have checked the superset logs for python stacktraces and included it here as text if any
  • I have reproduced the issue with at least the latest released version of superset
  • I have checked the issue tracker for the same issue and I haven’t found one similar

Superset version

0.15.4

Expected results

Box plot displays using provided options.

Actual results

Box plot throws KeyError on query for group by terms (1 or many)

Steps to reproduce

Add a datasource

SELECT *,
        ROUND(RAND(1), 2) AS `measurement` 
FROM (
    SELECT
        NOW()-INTERVAL 1 HOUR AS `date`
    ) t1
    CROSS JOIN (
        SELECT "US" AS `attribute_1` UNION SELECT "CA" UNION SELECT "DE" UNION SELECT "AU"
    ) t2
     CROSS JOIN (
        SELECT "M" AS `attribute_2` UNION SELECT "F" UNION SELECT "C" UNION SELECT "N\A" 
    ) t3
;
  1. Enter visualization for that data source
  2. Select Box Plot
  3. Add measurement to metrics; attribute_1, attribute_2, together or alone as group by terms
  4. Hit Query

Stack trace

2017-02-22 16:27:06,176:ERROR:root:u'attribute_1'
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/superset/views.py", line 1406, in explore_json
    payload = viz_obj.get_payload()
  File "/usr/local/lib/python2.7/dist-packages/superset/viz.py", line 360, in get_payload
    data = self.get_data()
  File "/usr/local/lib/python2.7/dist-packages/superset/viz.py", line 885, in get_data
    df = self.get_df()
  File "/usr/local/lib/python2.7/dist-packages/superset/viz.py", line 858, in get_df
    df = df.groupby(form_data.get('groupby')).agg(aggregate)
  File "/usr/local/lib/python2.7/dist-packages/pandas/core/generic.py", line 3778, in groupby
    **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/pandas/core/groupby.py", line 1427, in groupby
    return klass(obj, by, **kwds)
  File "/usr/local/lib/python2.7/dist-packages/pandas/core/groupby.py", line 354, in __init__
    mutated=self.mutated)
  File "/usr/local/lib/python2.7/dist-packages/pandas/core/groupby.py", line 2383, in _get_grouper
    in_axis, name, gpr = True, gpr, obj[gpr]
  File "/usr/local/lib/python2.7/dist-packages/pandas/core/frame.py", line 1997, in __getitem__
    return self._getitem_column(key)
  File "/usr/local/lib/python2.7/dist-packages/pandas/core/frame.py", line 2004, in _getitem_column
    return self._get_item_cache(key)
  File "/usr/local/lib/python2.7/dist-packages/pandas/core/generic.py", line 1350, in _get_item_cache
    values = self._data.get(item)
  File "/usr/local/lib/python2.7/dist-packages/pandas/core/internals.py", line 3290, in get
    loc = self.items.get_loc(item)
  File "/usr/local/lib/python2.7/dist-packages/pandas/indexes/base.py", line 1947, in get_loc
    return self._engine.get_loc(self._maybe_cast_indexer(key))
  File "pandas/index.pyx", line 137, in pandas.index.IndexEngine.get_loc (pandas/index.c:4154)
  File "pandas/index.pyx", line 159, in pandas.index.IndexEngine.get_loc (pandas/index.c:4018)
  File "pandas/hashtable.pyx", line 675, in pandas.hashtable.PyObjectHashTable.get_item (pandas/hashtable.c:12368)
  File "pandas/hashtable.pyx", line 683, in pandas.hashtable.PyObjectHashTable.get_item (pandas/hashtable.c:12322)
KeyError: u'attribute_1'

Additionally the Box Plot graph type is requiring a date. This shouldn’t be necessary.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
muraikicommented, Apr 11, 2019

Please don’t close this issue, as it prevents boxplots from being used.

0reactions
stale[bot]commented, Apr 10, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

BoxPlot - multiple issues · Issue #2222 · apache/superset
Box plot displays using provided options. Actual results. Box plot throws KeyError on query for group by terms (1 or many). Steps to...
Read more >
Plot multiple boxplot in one graph - Stack Overflow
I have normalized the features so they are in the same scale within [0 1] range. The test data can be found here....
Read more >
Interpreting data: boxplots and tables - The Open University
One problem with these is that they can include too much detail. Also they are not very useful for comparing two or more...
Read more >
Draw Multiple Boxplots in One Graph | Base R, ggplot2 & lattice
The issue is, I have 3 sets of data, and with the full data, I'll end up with some having 4 rows, and...
Read more >
BOXPLOT in R [boxplot by GROUP, MULTIPLE box plot, ...]
A box and whisker plot in base R can be plotted with the boxplot function. You can plot this type of graph from...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found