Generation

generate functionSun, 02 Apr 2023

读取csv文件中的两列数据,然后用折线图的方式输出,鼠标可以选择折线图中内容

def csv_plot(path, x_column, y_column): df = pd.read_csv(path) x = df[x_column].values y = df[y_column].values fig = go.FigureWidget(data=[go.Scatter(x=x, y=y, mode='markers')]) fig.layout.hovermode = 'closest' fig csv_plot('https://raw.githubusercontent.com/plotly/datasets/master/2014_usa_states.csv', 'Postal', 'Population')

Questions about programming?Chat with your personal AI assistant