1

I have a Pandas Serie S, with

Index Number
A    10 
B    13
C    14
D    23

My target is to make a dot plot of this list with python.

I'm following this tuto : with plotly

However, I don't understand how to go from my serie to the viz.

I tried the following :

fig = px.scatter(s, x="number", y="index",
                 title="Title")

fig.show()

But nothing happens.

What is wrong in my process to go to the plotly dot plot ?

petezurich
  • 9,280
  • 9
  • 43
  • 57
Alex Dana
  • 1,076
  • 3
  • 14
  • 30

1 Answers1

1

Similar to the tutorial you could save the data in a dataframe and plot it

from bokeh.io import output_notebook
output_notebook()
import pandas as pd
import plotly.express as px

S = pd.Series([10, 13, 14, 23], index=['A','B','C','D'])
df = pd.DataFrame({'index' : S.index,
                    'values': S.values})
fig = px.scatter(df, x="index", y="values")
fig.show()
Jonas Pirner
  • 152
  • 7
  • I'm using Spyder When i do this transformation and then fig.show(), nothing happens (no error, nothing), just next "in [x]" – Alex Dana Mar 09 '20 at 13:40
  • 1
    Try the code in a jupyter notebook and check if it works. I think the problem is probably related to Spyder. Check if there are some specifics for using plotly in a non-webbased enviroment – Jonas Pirner Mar 09 '20 at 13:57