Skip to content

Commit b8a198d

Browse files
Update bar-charts.md
renamed df2 to df
1 parent dccbdf8 commit b8a198d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

doc/python/bar-charts.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ df_summarized["percent of world population"]=100*df_summarized["pop"]/df_summari
327327
df_summarized["percent of world GDP"]=100*df_summarized["gdp"]/df_summarized["gdp"].sum()
328328
329329
330-
df2 = df_summarized[["continent",
330+
df = df_summarized[["continent",
331331
"percent of world population",
332332
"percent of world GDP",
333333
]]
@@ -338,12 +338,12 @@ df2 = df_summarized[["continent",
338338
fig=go.Figure()
339339
for category in df_summarized["continent"].values:
340340
fig.add_trace(go.Bar(
341-
x=df2.columns[1:],
341+
x=df.columns[1:],
342342
#we need to get a pandas series that contains just the values to graph;
343343
#we do so by selecting the right row, selecting the right columns
344344
#and then tranposing and using iloc to convert to a series
345345
#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]),
347347
name=str(category)
348348
349349

0 commit comments

Comments
 (0)