绘图时的情节网址问题

时间:2018-03-07 12:02:32

标签: python url plot plotly

运行以下代码以尝试生成并行坐标图时:

import plotly.plotly as py
import plotly.graph_objs as go
import numpy as np

import pandas as pd 

df = pd.read_csv('PublicHealthEngland-DataSPLIT.csv')

data = [
    go.Parcoords(
        line = dict(color = 'blue'),
        dimensions = list([
            dict(range = [int(np.min(df['Male'][1:])),int(np.max(df['Male'][1:]))],
                label = str(df['Male'][0]), values = df['Male'][1:]),
            dict(range = [int(np.min(df['Male.1'][1:])),int(np.max(df['Male.1'][1:]))], 
                label = str(df['Male.1'][0]), values = df['Male.1'][2:]) 
        ])
    )
]


py.iplot(data)

我收到以下错误:

PlotlyError: Because you didn't supply a 'file_id' in the call, we're assuming you're trying to snag a figure from a url. You supplied the url, '', we expected it to start with 'https://plot.ly'.
Run help on this function for more information.

尝试使用教程代码行时会出现同样的情况:

py.iplot(data, filename = 'PublicHealthEngland-DataSPLIT')

不确定这是如何尝试从网址中提取数据的。

数据如下所示:

                                  Unnamed: 0   Male Male.1 Male.2 Male.3  \
0                                   CCG Name    0-4    5-9  10-14  15-19   
1     NHS Airedale, Wharfdale And Craven CCG   4278   5001   4833   4589   
2                            NHS Ashford CCG   3981   4281   4066   4289   
3                     NHS Aylesbury Vale CCG   6488   7054   6596   6280   
4               NHS Barking And Dagenham CCG   9626  10117   8338   6852   
5                             NHS Barnet CCG  13274  14082  12297  10765   
6                           NHS Barnsley CCG   7518   8075   7181   6797   
7             NHS Basildon And Brentwood CCG   8711   8916   8331   7919   
8                          NHS Bassetlaw CCG   3162   3334   3119   3191   
9       NHS Bath And North East Somerset CCG   5043   5517   5466   7039   
10                      NHS Bedfordshire CCG  14839  15623  14077  13324   
11                            NHS Bexley CCG   7850   8231   7243   7123   
12              NHS Birmingham Crosscity CCG  24428  26217  23811  23238   
13      NHS Birmingham South And Central CCG  12050  12832  11755  11062   
14             NHS Blackburn With Darwen CCG   5898   6364   6085   5773   
15                         NHS Blackpool CCG   4697   4690   4652   4503   
16                            NHS Bolton CCG  10088  10986  10056   9480   
17               NHS Bracknell And Ascot CCG   4042   4629   4617   4394   
18                     NHS Bradford City CCG   5518   5935   5530   5198   

链接到我使用的程序包教程:https://plot.ly/python/parallel-coordinates-plot/#new-to-plotly

我目前的想法是如何将此绘图例程链接到存储在我的计算机上的文件(即csv文件)而不是上传的文件到一些情节服务器?

0 个答案:

没有答案