File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -327,7 +327,7 @@ df_summarized["percent of world population"]=100*df_summarized["pop"]/df_summari
327
327
df_summarized["percent of world GDP"]=100*df_summarized["gdp"]/df_summarized["gdp"].sum()
328
328
329
329
330
- df2 = df_summarized[["continent",
330
+ df = df_summarized[["continent",
331
331
"percent of world population",
332
332
"percent of world GDP",
333
333
]]
@@ -338,12 +338,12 @@ df2 = df_summarized[["continent",
338
338
fig=go.Figure()
339
339
for category in df_summarized["continent"].values:
340
340
fig.add_trace(go.Bar(
341
- x=df2 .columns[1:],
341
+ x=df .columns[1:],
342
342
#we need to get a pandas series that contains just the values to graph;
343
343
#we do so by selecting the right row, selecting the right columns
344
344
#and then tranposing and using iloc to convert to a series
345
345
#here, I assume that the bar element category variable is in column 0
346
- y=list(df2 .loc[df2 ["continent"]==category][list(df2 .columns[1:])].transpose().iloc[:,0]),
346
+ y=list(df .loc[df ["continent"]==category][list(df .columns[1:])].transpose().iloc[:,0]),
347
347
name=str(category)
348
348
349
349
You can’t perform that action at this time.
0 commit comments