Здравствуйте, мудрые программисты мира
У меня 2 вопроса
У меня есть такой набор данных:
Первая и главная проблема заключается в том, что он печатает странные сюжеты, например:
Не имеет смысла по сравнению с исходным сюжетом, который я использую в качестве ссылки ->
Вторая проблема заключается в том, что он печатает некоторые сообщения об ошибках ->
ERROR:bokeh.core.validation.check:E-1001 (BAD_COLUMN_NAME): Glyph refers to nonexistent column name: female_literacy [renderer: GlyphRenderer(id='1fb09ca6-67a9-47c6-a528-a01030829385', ...)]
ERROR:bokeh.core.validation.check:E-1001 (BAD_COLUMN_NAME): Glyph refers to nonexistent column name: female_literacy [renderer: GlyphRenderer(id='4ed4e766-485c-409a-9d61-1e0fdbd81c62', ...)]
ERROR:bokeh.core.validation.check:E-1001 (BAD_COLUMN_NAME): Glyph refers to nonexistent column name: femaleliteracy [renderer: GlyphRenderer(id='13f9c2a6-d8fc-49b2-909b-ddb50313f619', ...)]
ERROR:bokeh.core.validation.check:E-1001 (BAD_COLUMN_NAME): Glyph refers to nonexistent column name: femaleliteracy [renderer: GlyphRenderer(id='379aabbe-feee-4324-9819-6a019b615991', ...)]
Мой код выглядит так:
# Import row from bokeh.layouts
from bokeh.layouts import row
df = pd.read_csv('literacy_birth_rate.csv')
df.columns = ['Country ', 'Continent', 'femaleliteracy', 'fertility', 'population']
source = ColumnDataSource(df)
# Create the first figure: p1
p1 = figure(x_axis_label='fertility (children per woman)', y_axis_label='femaleliteracy (% population)')
# Add a circle glyph to p1
p1.circle(x='fertility', y='femaleliteracy', source=source)
# Create the second figure: p2
p2 = figure(x_axis_label='population', y_axis_label='femaleliteracy (% population)')
# Add a circle glyph to p2
p2.circle(x='population',y='femaleliteracy', source=source)
# Put p1 and p2 into a horizontal row: layout
layout = row(p1,p2)
# Specify the name of the output_file and show the result
output_file('fert_row.html')
show(layout)
****** изм ***********
*************** снова редактирование ***********************
Import row from bokeh.layouts
from bokeh.layouts import row
from bokeh.plotting import figure
df = pd.read_csv('literacy_birth_rate.csv')
df.columns = ['Country', 'Continent', 'femaleliteracy', 'fertility', 'population']
df.dropna(inplace=True)
source = ColumnDataSource(df)
# Create the first figure: p1
p1 = figure(x_axis_label='fertility (children per woman)', y_axis_label='femaleliteracy (% population)')
# Add a circle glyph to p1
p1.circle(x='fertility', y='femaleliteracy', source=source)
# Create the second figure: p2
p2 = figure(x_axis_label='population', y_axis_label='femaleliteracy (% population)')
# Add a circle glyph to p2
p2.circle(x='population',y='femaleliteracy', source=source)
# Put p1 and p2 into a horizontal row: layout
layout = row(p1,p2)
# Specify the name of the output_file and show the result
output_file('fert_row.html')
show(layout)