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.

WorldMap not working (getting 'None')

See original GitHub issue

Superset version: 0.17.0

The WorldMap visualization is not working in my installation. For instance, the slice ‘% Rural’ that comes as example does not work. It shows an error bar with ‘None’. And the server prints this backtrace:

2017-03-07 08:26:01,438:INFO:root:SELECT country_code AS country_code, SUM("SP_RUR_TOTL_ZS") AS "sum__SP_RUR_TOTL_ZS", SUM("SP_POP_TOTL") AS "sum__SP_POP_TOTL"
FROM wb_health_population
WHERE year >= '2014-01-01 00:00:00.000000' AND year <= '2014-01-02 00:00:00.000000' GROUP BY country_code ORDER BY "sum__SP_RUR_TOTL_ZS" DESC
 LIMIT 50000 OFFSET 0
2017-03-07 08:26:01,494:ERROR:root:None
Traceback (most recent call last):
  File "/usr/lib/python3.4/site-packages/superset/viz.py", line 258, in get_payload
    data = self.get_data(df)
  File "/usr/lib/python3.4/site-packages/superset/viz.py", line 1320, in get_data
    self.form_data.get('country_fieldtype'), row['country'])
  File "/usr/lib/python3.4/site-packages/superset/data/countries.py", line 2497, in get
    return all_lookups[field].get(symbol.lower())
KeyError: None
2017-03-07 08:26:01,495:INFO:root:Caching for the next 86400 seconds

When I try to add a WorldMap with my data I get another different error:

/usr/lib/python3.4/site-packages/flask_appbuilder/forms.py:245: FlaskWTFDeprecationWarning: "flask_wtf.Form" has been renamed to "FlaskForm" and will be removed in 1.0.
  form = self(obj=obj)
/usr/lib/python3.4/site-packages/flask_appbuilder/forms.py:245: FlaskWTFDeprecationWarning: "flask_wtf.Form" has been renamed to "FlaskForm" and will be removed in 1.0.
  form = self(obj=obj)
2017-03-07 08:34:47,922:ERROR:root:Metric 'None' is not valid
Traceback (most recent call last):
  File "/usr/lib/python3.4/site-packages/superset/viz.py", line 256, in get_payload
    df = self.get_df()
  File "/usr/lib/python3.4/site-packages/superset/viz.py", line 109, in get_df
    self.results = self.datasource.query(query_obj)
  File "/usr/lib/python3.4/site-packages/superset/models.py", line 1474, in query
    sql = self.get_query_str(engine, qry_start_dttm, **query_obj)
  File "/usr/lib/python3.4/site-packages/superset/models.py", line 1316, in get_query_str
    raise Exception(_("Metric '{}' is not valid".format(m)))
Exception: Metric 'None' is not valid
2017-03-07 08:34:47,923:INFO:root:Caching for the next 86400 seconds

I tried to debug it by myself and found that metrics has an array like [my_var, None], so in the iteration, when it comes to None it failed to valid it as a metric. I tried to filter that in the code but then appeared another error:

2017-03-07 08:43:32,901:INFO:root:SELECT source_market AS source_market, SUM(kpi_val) AS sum__kpi_val 
FROM hbgdwc.ttv_gross_service_date_source_market 
WHERE service_date >= '2016-03-07 08:43:32' AND service_date <= '2017-03-07 08:43:32' GROUP BY source_market ORDER BY sum__kpi_val DESC 
 LIMIT 50000
2017-03-07 08:43:33,112:ERROR:root:'[None] not in index'
Traceback (most recent call last):
  File "/usr/lib/python3.4/site-packages/superset/viz.py", line 258, in get_payload
    data = self.get_data(df)
  File "/usr/lib/python3.4/site-packages/superset/viz.py", line 1312, in get_data
    ndf = df[cols]
  File "/usr/lib64/python3.4/site-packages/pandas/core/frame.py", line 1991, in __getitem__
    return self._getitem_array(key)
  File "/usr/lib64/python3.4/site-packages/pandas/core/frame.py", line 2035, in _getitem_array
    indexer = self.ix._convert_to_indexer(key, axis=1)
  File "/usr/lib64/python3.4/site-packages/pandas/core/indexing.py", line 1214, in _convert_to_indexer
    raise KeyError('%s not in index' % objarr[mask])
KeyError: '[None] not in index'
2017-03-07 08:43:33,115:INFO:root:Caching for the next 86400 seconds

I suppose that the problems with the ‘% Rural’ example and my data are differents, but I can’t tell.

Also, I have added a key for the MapBox API, but I think this is irrelevant, as that map doesn’t use it.

Thank you very much.

Update

The error with my own data was my fault, and it seems it has nothing to do with the WorldMap view.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:11 (2 by maintainers)

github_iconTop GitHub Comments

7reactions
Lomascolocommented, Sep 21, 2017

I found that I got the same error (Metric ‘None’ is not valid) but was solved when I updated the Bubble Size field, even if I was not presenting bubbles (show bubbles check box unchecked).

1reaction
linwoodc3commented, Apr 21, 2017

Hi all. I’m getting the same Metric 'None' is not valid error on the WorldMap visualization.

I tried using superset 0.17.4 and 0.17.1. No luck. I tried this viz on my custom dataset, and also tried it on the World Health demo data, by opening the Table and trying to create a new viz. Any ideas?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Microsoft Flight Simulator WorldMap doens't work
The problem is the game won't start. I click several times on the FLY button and nothing happens! All others work: Tutorials, Challenges,...
Read more >
World map with ggmap - Stack Overflow
So, my question is how can I use get_map to get a world map? Session info: sessionInfo() R version 2.15.0 (2012-03-30) Platform: i386-pc-mingw32 ......
Read more >
Create axesm-based map for world region - MATLAB worldmap
This MATLAB function or worldmap(region) sets up an empty axesm-based map ... First, get geoid heights and a geographic postings reference object.
Read more >
Worldmap Panel plugin for Grafana
World Map panel for Grafana. Displays time series data or geohash data from Elasticsearch overlaid on a world map.
Read more >
Mapping and Plotting Tools - GeoPandas
However, the default appearance of the legend and plot axes may not be ... None does the “default behavior” based on matplotlib, and...
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