Why is this python script dash plotly express not working showing a figure?

Viewed 33

I'm doing a k-means, and cant manage to print a figure. why? how can I solve this?

the data has 2900 rows, and all seems to be right

(no errors appear)

clusters=len(X)

kmeans = cluster.KMeans(n_clusters=clusters, 
                        random_state=42).fit(X,Y)
print("kmeans",kmeans)
dff=px.data[X,Y]
figure = px.scatter(dff,x=X.squeeze(), 
                                  y=Y.squeeze(), 
                                  color=dict(color=kmeans.labels_),     
                                  #marker=dict(color=kmeans.labels_)
                                  )
       
figure.show()

its based on this .py

 from sklearn import datasets
from sklearn import cluster
import plotly
from plotly import graph_objs
import plotly.express as px

iris = datasets.load_iris()
kmeans = cluster.KMeans(n_clusters=3, 
                        random_state=42).fit(iris.data[:,0:2])
figure = [px.scatter(iris,x=iris.data[:,0], 
                                  y=iris.data[:,1], 
                                  #mode='markers',     
                                  #marker=dict(color=kmeans.labels_)
                                  )
       ]
figure.show()
0 Answers
Related