Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -14,9 +14,9 @@ def display_data():
|
|
14 |
df = pd.read_csv(url, index_col=0)
|
15 |
df=pd.DataFrame(df)
|
16 |
pyg.walk(df)
|
17 |
-
|
18 |
#vis_spec=r"""{"config":[{"config":{"defaultAggregated":true,"geoms":["auto"],"coordSystem":"generic","limit":-1,"timezoneDisplayOffset":0},"encodings":{"dimensions":[{"fid":"Year","name":"Year","basename":"Year","analyticType":"dimension","semanticType":"ordinal","aggName":"sum","offset":0},{"fid":"Country Name","name":"Country Name","basename":"Country Name","semanticType":"nominal","analyticType":"dimension","offset":0},{"fid":"Country Code","name":"Country Code","basename":"Country Code","semanticType":"nominal","analyticType":"dimension","offset":0},{"fid":"Region","name":"Region","basename":"Region","semanticType":"nominal","analyticType":"dimension","offset":0},{"fid":"IncomeGroup","name":"IncomeGroup","basename":"IncomeGroup","semanticType":"nominal","analyticType":"dimension","offset":0},{"fid":"gw_mea_key_fid","name":"Measure names","analyticType":"dimension","semanticType":"nominal"}],"measures":[{"fid":"Birth rate, crude (per 1,000 people)","name":"Birth rate, crude (per 1,000 people)","basename":"Birth rate, crude (per 1,000 people)","analyticType":"measure","semanticType":"quantitative","aggName":"sum","offset":0},{"fid":"Death rate, crude (per 1,000 people)","name":"Death rate, crude (per 1,000 people)","basename":"Death rate, crude (per 1,000 people)","analyticType":"measure","semanticType":"quantitative","aggName":"sum","offset":0},{"fid":"Electric power consumption (kWh per capita)","name":"Electric power consumption (kWh per capita)","basename":"Electric power consumption (kWh per capita)","analyticType":"measure","semanticType":"quantitative","aggName":"sum","offset":0},{"fid":"GDP (USD)","name":"GDP (USD)","basename":"GDP (USD)","analyticType":"measure","semanticType":"quantitative","aggName":"sum","offset":0},{"fid":"GDP per capita (USD)","name":"GDP per capita (USD)","basename":"GDP per capita (USD)","analyticType":"measure","semanticType":"quantitative","aggName":"sum","offset":0},{"fid":"Individuals using the Internet (% of population)","name":"Individuals using the Internet (% of population)","basename":"Individuals using the Internet (% of population)","analyticType":"measure","semanticType":"quantitative","aggName":"sum","offset":0},{"fid":"Infant mortality rate (per 1,000 live births)","name":"Infant mortality rate (per 1,000 live births)","basename":"Infant mortality rate (per 1,000 live births)","analyticType":"measure","semanticType":"quantitative","aggName":"sum","offset":0},{"fid":"Life expectancy at birth (years)","name":"Life expectancy at birth (years)","basename":"Life expectancy at birth (years)","analyticType":"measure","semanticType":"quantitative","aggName":"sum","offset":0},{"fid":"Population density (people per sq. km of land area)","name":"Population density (people per sq. km of land area)","basename":"Population density (people per sq. km of land area)","analyticType":"measure","semanticType":"quantitative","aggName":"sum","offset":0},{"fid":"Unemployment (% of total labor force) (modeled ILO estimate)","name":"Unemployment (% of total labor force) (modeled ILO estimate)","basename":"Unemployment (% of total labor force) (modeled ILO estimate)","analyticType":"measure","semanticType":"quantitative","aggName":"sum","offset":0},{"fid":"gw_count_fid","name":"Row count","analyticType":"measure","semanticType":"quantitative","aggName":"sum","computed":true,"expression":{"op":"one","params":[],"as":"gw_count_fid"}},{"fid":"gw_mea_val_fid","name":"Measure values","analyticType":"measure","semanticType":"quantitative","aggName":"sum"}],"rows":[{"fid":"Birth rate, crude (per 1,000 people)","name":"Birth rate, crude (per 1,000 people)","basename":"Birth rate, crude (per 1,000 people)","analyticType":"measure","semanticType":"quantitative","aggName":"mean","offset":0}],"columns":[{"fid":"Year","name":"Year","basename":"Year","analyticType":"dimension","semanticType":"ordinal","aggName":"sum","offset":0}],"color":[{"fid":"IncomeGroup","name":"IncomeGroup","basename":"IncomeGroup","semanticType":"nominal","analyticType":"dimension","offset":0}],"opacity":[],"size":[],"shape":[],"radius":[],"theta":[],"longitude":[],"latitude":[],"geoId":[],"details":[],"filters":[{"fid":"IncomeGroup","name":"IncomeGroup","basename":"IncomeGroup","semanticType":"nominal","analyticType":"dimension","offset":0,"rule":null}],"text":[]},"layout":{"showActions":false,"showTableSummary":false,"stack":"stack","interactiveScale":false,"zeroScale":true,"size":{"mode":"auto","width":320,"height":200},"format":{},"geoKey":"name","resolve":{"x":false,"y":false,"color":false,"opacity":false,"shape":false,"size":false}},"visId":"gw_DGUp","name":"Chart 1"}],"chart_map":{},"workflow_list":[{"workflow":[{"type":"view","query":[{"op":"aggregate","groupBy":["Year","IncomeGroup"],"measures":[{"field":"Birth rate, crude (per 1,000 people)","agg":"mean","asFieldKey":"Birth rate, crude (per 1,000 people)_mean"}]}]}]}],"version":"0.4.8.10"}"""
|
19 |
-
|
20 |
|
21 |
|
22 |
# Create a Gradio interface
|
|
|
14 |
df = pd.read_csv(url, index_col=0)
|
15 |
df=pd.DataFrame(df)
|
16 |
pyg.walk(df)
|
17 |
+
pyg_html = pyg.to_html(df)
|
18 |
#vis_spec=r"""{"config":[{"config":{"defaultAggregated":true,"geoms":["auto"],"coordSystem":"generic","limit":-1,"timezoneDisplayOffset":0},"encodings":{"dimensions":[{"fid":"Year","name":"Year","basename":"Year","analyticType":"dimension","semanticType":"ordinal","aggName":"sum","offset":0},{"fid":"Country Name","name":"Country Name","basename":"Country Name","semanticType":"nominal","analyticType":"dimension","offset":0},{"fid":"Country Code","name":"Country Code","basename":"Country Code","semanticType":"nominal","analyticType":"dimension","offset":0},{"fid":"Region","name":"Region","basename":"Region","semanticType":"nominal","analyticType":"dimension","offset":0},{"fid":"IncomeGroup","name":"IncomeGroup","basename":"IncomeGroup","semanticType":"nominal","analyticType":"dimension","offset":0},{"fid":"gw_mea_key_fid","name":"Measure names","analyticType":"dimension","semanticType":"nominal"}],"measures":[{"fid":"Birth rate, crude (per 1,000 people)","name":"Birth rate, crude (per 1,000 people)","basename":"Birth rate, crude (per 1,000 people)","analyticType":"measure","semanticType":"quantitative","aggName":"sum","offset":0},{"fid":"Death rate, crude (per 1,000 people)","name":"Death rate, crude (per 1,000 people)","basename":"Death rate, crude (per 1,000 people)","analyticType":"measure","semanticType":"quantitative","aggName":"sum","offset":0},{"fid":"Electric power consumption (kWh per capita)","name":"Electric power consumption (kWh per capita)","basename":"Electric power consumption (kWh per capita)","analyticType":"measure","semanticType":"quantitative","aggName":"sum","offset":0},{"fid":"GDP (USD)","name":"GDP (USD)","basename":"GDP (USD)","analyticType":"measure","semanticType":"quantitative","aggName":"sum","offset":0},{"fid":"GDP per capita (USD)","name":"GDP per capita (USD)","basename":"GDP per capita (USD)","analyticType":"measure","semanticType":"quantitative","aggName":"sum","offset":0},{"fid":"Individuals using the Internet (% of population)","name":"Individuals using the Internet (% of population)","basename":"Individuals using the Internet (% of population)","analyticType":"measure","semanticType":"quantitative","aggName":"sum","offset":0},{"fid":"Infant mortality rate (per 1,000 live births)","name":"Infant mortality rate (per 1,000 live births)","basename":"Infant mortality rate (per 1,000 live births)","analyticType":"measure","semanticType":"quantitative","aggName":"sum","offset":0},{"fid":"Life expectancy at birth (years)","name":"Life expectancy at birth (years)","basename":"Life expectancy at birth (years)","analyticType":"measure","semanticType":"quantitative","aggName":"sum","offset":0},{"fid":"Population density (people per sq. km of land area)","name":"Population density (people per sq. km of land area)","basename":"Population density (people per sq. km of land area)","analyticType":"measure","semanticType":"quantitative","aggName":"sum","offset":0},{"fid":"Unemployment (% of total labor force) (modeled ILO estimate)","name":"Unemployment (% of total labor force) (modeled ILO estimate)","basename":"Unemployment (% of total labor force) (modeled ILO estimate)","analyticType":"measure","semanticType":"quantitative","aggName":"sum","offset":0},{"fid":"gw_count_fid","name":"Row count","analyticType":"measure","semanticType":"quantitative","aggName":"sum","computed":true,"expression":{"op":"one","params":[],"as":"gw_count_fid"}},{"fid":"gw_mea_val_fid","name":"Measure values","analyticType":"measure","semanticType":"quantitative","aggName":"sum"}],"rows":[{"fid":"Birth rate, crude (per 1,000 people)","name":"Birth rate, crude (per 1,000 people)","basename":"Birth rate, crude (per 1,000 people)","analyticType":"measure","semanticType":"quantitative","aggName":"mean","offset":0}],"columns":[{"fid":"Year","name":"Year","basename":"Year","analyticType":"dimension","semanticType":"ordinal","aggName":"sum","offset":0}],"color":[{"fid":"IncomeGroup","name":"IncomeGroup","basename":"IncomeGroup","semanticType":"nominal","analyticType":"dimension","offset":0}],"opacity":[],"size":[],"shape":[],"radius":[],"theta":[],"longitude":[],"latitude":[],"geoId":[],"details":[],"filters":[{"fid":"IncomeGroup","name":"IncomeGroup","basename":"IncomeGroup","semanticType":"nominal","analyticType":"dimension","offset":0,"rule":null}],"text":[]},"layout":{"showActions":false,"showTableSummary":false,"stack":"stack","interactiveScale":false,"zeroScale":true,"size":{"mode":"auto","width":320,"height":200},"format":{},"geoKey":"name","resolve":{"x":false,"y":false,"color":false,"opacity":false,"shape":false,"size":false}},"visId":"gw_DGUp","name":"Chart 1"}],"chart_map":{},"workflow_list":[{"workflow":[{"type":"view","query":[{"op":"aggregate","groupBy":["Year","IncomeGroup"],"measures":[{"field":"Birth rate, crude (per 1,000 people)","agg":"mean","asFieldKey":"Birth rate, crude (per 1,000 people)_mean"}]}]}]}],"version":"0.4.8.10"}"""
|
19 |
+
return pyg_html
|
20 |
|
21 |
|
22 |
# Create a Gradio interface
|