散景显示空图表

问题描述 投票:0回答:1

大家好,我遇到的问题是,当我尝试运行我的代码时,我创建的图表为空。所以我看不到我的温度和时间日期。

如果有帮助,这里是我的数据库:id hum temp time date 1 59 18 10:03:06 2020-05-16 2 59 19 10:05:22 2020-05-16

这里是我的代码:

from pandas import DataFrame
import sqlite3
import matplotlib.pyplot as plt
from bokeh.plotting import figure, output_file, show
from bokeh.models import ColumnDataSource


output_file("test.html")

con = sqlite3.connect("/home/pi/test2.db")
df = pd.read_sql_query("SELECT * from data4 limit 10;",con)

source = ColumnDataSource(df)

p = figure()
p.line(x="time", y="temp", source = source)
show(p)
python pandas bokeh pandas-bokeh
1个回答
0
投票

您没有收到错误消息吗?因为看起来您根本没有导入pandas。]

© www.soinside.com 2019 - 2024. All rights reserved.