Black Lives Matter. Please consider donating to Black Girls Code today.

Pandas Series not working?

Hey,

The example from here seems to not be working (Trying on freshly installed Python 3.7, Jupyter Notebook, Pandas and Plotly) https://plot.ly/pandas/line-and-scatter/

It throws this:

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-52-3bc5b5c50036> in <module>
     30 
     31 # IPython notebook
---> 32 py.iplot(fig, filename='pandas/multiple-scatter')

~\Envs\sk_test\lib\site-packages\plotly\plotly\plotly.py in iplot(figure_or_data, **plot_options)
    140     if 'auto_open' not in plot_options:
    141         plot_options['auto_open'] = False
--> 142     url = plot(figure_or_data, **plot_options)
    143 
    144     if isinstance(figure_or_data, dict):

~\Envs\sk_test\lib\site-packages\plotly\plotly\plotly.py in plot(figure_or_data, validate, **plot_options)
    205 
    206     """
--> 207     figure = tools.return_figure_from_figure_or_data(figure_or_data, validate)
    208     for entry in figure['data']:
    209         if ('type' in entry) and (entry['type'] == 'scattergl'):

~\Envs\sk_test\lib\site-packages\plotly\tools.py in return_figure_from_figure_or_data(figure_or_data, validate_figure)
   1506 
   1507         try:
-> 1508             figure = Figure(**figure).to_dict()
   1509         except exceptions.PlotlyError as err:
   1510             raise exceptions.PlotlyError("Invalid 'figure_or_data' argument. "

~\Envs\sk_test\lib\site-packages\plotly\graph_objs\_figure.py in __init__(self, data, layout, frames, skip_invalid)
    447             is invalid AND skip_invalid is False
    448         """
--> 449         super(Figure, self).__init__(data, layout, frames, skip_invalid)
    450 
    451     def add_area(

~\Envs\sk_test\lib\site-packages\plotly\basedatatypes.py in __init__(self, data, layout_plotly, frames, skip_invalid)
    139         # ### Import traces ###
    140         data = self._data_validator.validate_coerce(data,
--> 141                                                     skip_invalid=skip_invalid)
    142 
    143         # ### Save tuple of trace objects ###

~\Envs\sk_test\lib\site-packages\_plotly_utils\basevalidators.py in validate_coerce(self, v, skip_invalid)
   2308                     else:
   2309                         trace = self.class_map[trace_type](
-> 2310                             skip_invalid=skip_invalid, **v_copy)
   2311                         res.append(trace)
   2312                 else:

~\Envs\sk_test\lib\site-packages\plotly\graph_objs\_scatter.py in __init__(self, arg, cliponaxis, connectgaps, customdata, customdatasrc, dx, dy, error_x, error_y, fill, fillcolor, groupnorm, hoverinfo, hoverinfosrc, hoverlabel, hoveron, hovertemplate, hovertemplatesrc, hovertext, hovertextsrc, ids, idssrc, legendgroup, line, marker, mode, name, opacity, orientation, r, rsrc, selected, selectedpoints, showlegend, stackgaps, stackgroup, stream, t, text, textfont, textposition, textpositionsrc, textsrc, tsrc, uid, uirevision, unselected, visible, x, x0, xaxis, xcalendar, xsrc, y, y0, yaxis, ycalendar, ysrc, **kwargs)
   2527         self['t'] = t if t is not None else _v
   2528         _v = arg.pop('text', None)
-> 2529         self['text'] = text if text is not None else _v
   2530         _v = arg.pop('textfont', None)
   2531         self['textfont'] = textfont if textfont is not None else _v

~\Envs\sk_test\lib\site-packages\plotly\basedatatypes.py in __setitem__(self, prop, value)
   2827             # ### Handle simple property ###
   2828             else:
-> 2829                 self._set_prop(prop, value)
   2830 
   2831         # Handle non-scalar case

~\Envs\sk_test\lib\site-packages\plotly\basedatatypes.py in _set_prop(self, prop, val)
   3068                 return
   3069             else:
-> 3070                 raise err
   3071 
   3072         # val is None

~\Envs\sk_test\lib\site-packages\plotly\basedatatypes.py in _set_prop(self, prop, val)
   3063         validator = self._validators.get(prop)
   3064         try:
-> 3065             val = validator.validate_coerce(val)
   3066         except ValueError as err:
   3067             if self._skip_invalid:

~\Envs\sk_test\lib\site-packages\_plotly_utils\basevalidators.py in validate_coerce(self, v)
    978                     v = str(v)
    979                 else:
--> 980                     self.raise_invalid_val(v)
    981 
    982             if self.no_blank and len(v) == 0:

~\Envs\sk_test\lib\site-packages\_plotly_utils\basevalidators.py in raise_invalid_val(self, v, inds)
    252             typ=type_str(v),
    253             v=repr(v),
--> 254             valid_clr_desc=self.description()))
    255 
    256     def raise_invalid_elements(self, invalid_els):

ValueError: 
    Invalid value of type 'pandas.core.series.Series' received for the 'text' property of scatter
        Received value: 11                   Afghanistan
23                       Albania
35                       Algeria
47                        Angola
59                     Argentina
71                     Australia
83                       Austria
95                       Bahrain
107                   Bangladesh
119                      Belgium
131                        Benin
143                      Bolivia
155       Bosnia and Herzegovina
167                     Botswana
179                       Brazil
191                     Bulgaria
203                 Burkina Faso
215                      Burundi
227                     Cambodia
239                     Cameroon
251                       Canada
263     Central African Republic
275                         Chad
287                        Chile
299                        China
311                     Colombia
323                      Comoros
335             Congo, Dem. Rep.
347                  Congo, Rep.
359                   Costa Rica
                  ...           
1355                Sierra Leone
1367                   Singapore
1379             Slovak Republic
1391                    Slovenia
1403                     Somalia
1415                South Africa
1427                       Spain
1439                   Sri Lanka
1451                       Sudan
1463                   Swaziland
1475                      Sweden
1487                 Switzerland
1499                       Syria
1511                      Taiwan
1523                    Tanzania
1535                    Thailand
1547                        Togo
1559         Trinidad and Tobago
1571                     Tunisia
1583                      Turkey
1595                      Uganda
1607              United Kingdom
1619               United States
1631                     Uruguay
1643                   Venezuela
1655                     Vietnam
1667          West Bank and Gaza
1679                 Yemen, Rep.
1691                      Zambia
1703                    Zimbabwe
Name: country, Length: 142, dtype: object

    The 'text' property is a string and must be specified as:
      - A string
      - A number that will be converted to a string
      - A tuple, list, or one-dimensional numpy array of the above