Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/348.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
位置参数跟随关键字参数图形,并带有破折号python_Python_Python 3.x_Plotly Dash - Fatal编程技术网

位置参数跟随关键字参数图形,并带有破折号python

位置参数跟随关键字参数图形,并带有破折号python,python,python-3.x,plotly-dash,Python,Python 3.x,Plotly Dash,这段代码对传感器获取的数据进行了图形化,使用dash库进行图形化,当我试图运行它时,它会向我发送错误,显然错误在“返回”中 这是代码: def update_graph_scatter(interval): dataSQL = [] X = deque(maxlen=10) Y = deque(maxlen=10) sql_conn = MySQLdb.connect('localhost', 'root', 'pass', 'DB') cur

这段代码对传感器获取的数据进行了图形化,使用dash库进行图形化,当我试图运行它时,它会向我发送错误,显然错误在“返回”中

这是代码:

def update_graph_scatter(interval):

    dataSQL = []
    X = deque(maxlen=10)    
    Y = deque(maxlen=10)

    sql_conn = MySQLdb.connect('localhost', 'root', 'pass', 'DB')
    cursor = sql_conn.cursor()
    cursor.execute("SELECT value,timestamp FROM sensorParser where sensor='TC'")
    #and timestamp >= timestamp()-4seg"
    rows = cursor.fetchall()
    for row in rows:
        dataSQL.append(list(row))
        labels = ['value','timestamp']
        df = pd.DataFrame.from_records(dataSQL, columns=labels)
        X = df['timestamp']
        Y = df['value'].astype(float)

        #if (float(df['value'][0]) > 25):

    data = plotly.graph_objs.Scatter(
            x=list(X),
            y=list(Y),
            name='TEMP',
            mode= 'lines+markers',

            )

    return {'data': [data],'layout':go.Layout(title="TEMPERATURA",xaxis=dict(range=[min(X),max(X)]),
                                            yaxis=dict(range=[min(Y),max(Y)]),MAX_POINTS_TO_SHOW,)}

关于。

调用函数时,您有位置参数,例如-
foo(1,2,3)
和关键字参数,例如
foo(a=1,b=2,c=3)
。在调用
go.Layout
时,位置参数不能出现在关键字参数和代码中的问题之后
MAX\u POINTS\u TO\u SHOW
前面需要有一个变量名